1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-06 13:54:12 +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,15 +1103,17 @@ 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 (defaultPath) {
/* if the file is not the default, use full path */ /* if the file is not the default, use full path */
if (strcmp(wantedPath, defaultPath) != 0) { if (strcmp(wantedPath, defaultPath) != 0) {
*file = wantedPath; *file = wstrdup(wantedPath);
} else { } else {
*file = wstrdup(*file); *file = wstrdup(*file);
wfree(wantedPath);
} }
wfree(defaultPath); wfree(defaultPath);
} }
wfree(wantedPath);
}
} else { } else {
*file = NULL; *file = NULL;
} }