mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 04:20:27 +01:00
wmlib: Potential leak of memory pointed to by 'entry'
two similar ones, if we return then free allocated memory Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
This commit is contained in:
committed by
Carlos R. Mafra
parent
3187f95278
commit
ff1e6f8273
@@ -84,6 +84,7 @@ WMMenuAddItem(WMMenu * menu, char *text, WMMenuAction action,
|
||||
entry->entryline = malloc(strlen(text) + 100);
|
||||
if (!entry->entryline) {
|
||||
free(menu);
|
||||
free(entry);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -132,6 +133,7 @@ int WMMenuAddSubmenu(WMMenu * menu, char *text, WMMenu * submenu)
|
||||
entry->entryline = malloc(strlen(text) + 100);
|
||||
if (!entry->entryline) {
|
||||
free(menu);
|
||||
free(entry);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user