1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-30 02:12:30 +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 {
defaultPath = FindImage(wPreferences.icon_path, *file);
wantedPath = WMGetTextFieldText(panel->fileField);
/* if the file is not the default, use full path */
if (strcmp(wantedPath, defaultPath) != 0) {
*file = wantedPath;
} else {
*file = wstrdup(*file);
wfree(wantedPath);
if (defaultPath) {
/* if the file is not the default, use full path */
if (strcmp(wantedPath, defaultPath) != 0) {
*file = wstrdup(wantedPath);
} else {
*file = wstrdup(*file);
}
wfree(defaultPath);
}
wfree(defaultPath);
wfree(wantedPath);
}
} else {
*file = NULL;