mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-22 05:48:01 +01:00
WMaker: fix memory leak in app icon changing (Coverity #50139)
As pointed by Coverity, there are some cases where the name of the file returned by wIconChooserDialog could be left unfreed. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
3a68e974b6
commit
c2a357fe1b
@@ -534,14 +534,17 @@ static void setIconCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
|
|
||||||
result = wIconChooserDialog(scr, &file, icon->wm_instance, icon->wm_class);
|
result = wIconChooserDialog(scr, &file, icon->wm_instance, icon->wm_class);
|
||||||
|
|
||||||
if (result && !icon->destroyed) {
|
if (result) {
|
||||||
|
if (!icon->destroyed) {
|
||||||
if (!wIconChangeImageFile(icon->icon, file)) {
|
if (!wIconChangeImageFile(icon->icon, file)) {
|
||||||
wMessageDialog(scr, _("Error"),
|
wMessageDialog(scr, _("Error"),
|
||||||
_("Could not open specified icon file"), _("OK"), NULL, NULL);
|
_("Could not open specified icon file"),
|
||||||
|
_("OK"), NULL, NULL);
|
||||||
} else {
|
} else {
|
||||||
wDefaultChangeIcon(icon->wm_instance, icon->wm_class, file);
|
wDefaultChangeIcon(icon->wm_instance, icon->wm_class, file);
|
||||||
wAppIconPaint(icon);
|
wAppIconPaint(icon);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (file)
|
if (file)
|
||||||
wfree(file);
|
wfree(file);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user