1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-04 12:54:20 +01:00

Coverity: fix dialog dereference null return value

This patch is making sure defaultPath returns from FindImage() is not null
and freeing the variables.
This commit is contained in:
David Maciejak
2023-03-02 22:24:52 +08:00
committed by Carlos R. Mafra
parent e9717ed719
commit 0e00c6b605

View File

@@ -1103,14 +1103,16 @@ Bool wIconChooserDialog(WScreen *scr, char **file, const char *instance, const c
} else { } else {
defaultPath = FindImage(wPreferences.icon_path, *file); defaultPath = FindImage(wPreferences.icon_path, *file);
wantedPath = WMGetTextFieldText(panel->fileField); wantedPath = WMGetTextFieldText(panel->fileField);
/* if the file is not the default, use full path */ if (defaultPath) {
if (strcmp(wantedPath, defaultPath) != 0) { /* if the file is not the default, use full path */
*file = wantedPath; if (strcmp(wantedPath, defaultPath) != 0) {
} else { *file = wstrdup(wantedPath);
*file = wstrdup(*file); } else {
wfree(wantedPath); *file = wstrdup(*file);
}
wfree(defaultPath);
} }
wfree(defaultPath); wfree(wantedPath);
} }
} else { } else {
*file = NULL; *file = NULL;