mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-30 22:05:27 +00:00
parser: fix memory leak on calloc() failure
Fix leaked memory if calloc() fails. Found by cppcheck. Signed-off-by: Steve Beattie <steve@nxnw.org> Acked-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
@@ -177,8 +177,10 @@ static void process_name(const void *nodep, VISIT value, int __unused level)
|
||||
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;
|
||||
|
Reference in New Issue
Block a user