From bb7d9b48bd5c09e625f5454fa1d9394bcdd5a20e Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sat, 17 May 2014 16:43:25 +0200 Subject: [PATCH] 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 --- wmlib/menu.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/wmlib/menu.c b/wmlib/menu.c index 9a08ba5c..6646cd70 100644 --- a/wmlib/menu.c +++ b/wmlib/menu.c @@ -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; }