mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
WMaker: fix memory leak in window inspector (Coverity #50116)
As pointed by Coverity, in this specific case the string previously stored in 'file' was lost when replaced with the string from 'db_icon'. The logic have been simplified to avoid the case. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
43972d307a
commit
4894e3fe4d
@@ -307,7 +307,7 @@ static void changePage(WMWidget *bPtr, void *client_data)
|
||||
static int showIconFor(WMScreen *scrPtr, InspectorPanel *panel, const char *wm_instance, const char *wm_class, int flags)
|
||||
{
|
||||
WMPixmap *pixmap = (WMPixmap *) NULL;
|
||||
char *file = NULL, *path = NULL, *db_icon = NULL;
|
||||
char *file = NULL, *path = NULL;
|
||||
|
||||
if ((flags & USE_TEXT_FIELD) != 0) {
|
||||
file = WMGetTextFieldText(panel->fileText);
|
||||
@@ -315,17 +315,16 @@ static int showIconFor(WMScreen *scrPtr, InspectorPanel *panel, const char *wm_i
|
||||
wfree(file);
|
||||
file = NULL;
|
||||
}
|
||||
} else {
|
||||
} else if (flags & REVERT_TO_DEFAULT) {
|
||||
const char *db_icon;
|
||||
|
||||
/* Get the application icon, default NOT included */
|
||||
db_icon = wDefaultGetIconFile(wm_instance, wm_class, False);
|
||||
if (db_icon != NULL)
|
||||
file = wstrdup(db_icon);
|
||||
}
|
||||
if (db_icon != NULL && (flags & REVERT_TO_DEFAULT) != 0) {
|
||||
if (file)
|
||||
if (db_icon != NULL) {
|
||||
file = wstrdup(db_icon);
|
||||
flags |= UPDATE_TEXT_FIELD;
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & UPDATE_TEXT_FIELD) != 0)
|
||||
WMSetTextFieldText(panel->fileText, file);
|
||||
|
||||
Reference in New Issue
Block a user