two similar ones, if we return then free allocated memory
Signed-off-by: Amadeusz Sławiński <[email protected]>
---
wmlib/menu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/wmlib/menu.c b/wmlib/menu.c
index 0378427..9a08ba5 100644
--- a/wmlib/menu.c
+++ b/wmlib/menu.c
@@ -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;
}
--
1.9.3
--
To unsubscribe, send mail to [email protected].