Fix leaked memory if calloc() fails. Found by cppcheck.

Signed-off-by: Steve Beattie <[email protected]>
---
 parser/parser_alias.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: b/parser/parser_alias.c
===================================================================
--- a/parser/parser_alias.c
+++ b/parser/parser_alias.c
@@ -177,8 +177,10 @@ static void process_name(const void *nod
                        return;
                /* aliases create alternate names */
                alt = (struct alt_name *) calloc(1, sizeof(struct alt_name));
-               if (!alt)
+               if (!alt) {
+                       free(n);
                        return;
+               }
                alt->name = n;
                alt->next = prof->altnames;
                prof->altnames = alt;


-- 
AppArmor mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to