From: Christophe CURIS <[email protected]>

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 <[email protected]>
---
 wmlib/menu.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/wmlib/menu.c b/wmlib/menu.c
index 9a08ba5..6646cd7 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;
        }
-- 
1.9.2


-- 
To unsubscribe, send mail to [email protected].

Reply via email to