mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-18 12:00:31 +01:00
wmlib: remove wrong free highlighted by commit 65dc99d805
It is really unlikely that the free(menu) was the correct thing, it is more likely that it was a typo instead of the appropriate 'free(menu)': It would be excessive behaviour to free the complete menu only because an entry cannot be added, and even if it were the case that would not be the right way to do it because it would leak all the entries already allocated for it. (This fixes Coverity #50154 and #50155) Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
ff1e6f8273
commit
bb7d9b48bd
@@ -83,7 +83,6 @@ WMMenuAddItem(WMMenu * menu, char *text, WMMenuAction action,
|
||||
|
||||
entry->entryline = malloc(strlen(text) + 100);
|
||||
if (!entry->entryline) {
|
||||
free(menu);
|
||||
free(entry);
|
||||
return -1;
|
||||
}
|
||||
@@ -132,7 +131,6 @@ 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