[apparmor] [patch 09/18] parser: fix memory leak on calloc() failure
John Johansen
john.johansen at canonical.com
Fri Jan 24 10:45:53 UTC 2014
On 01/16/2014 02:06 PM, Steve Beattie wrote:
> Fix leaked memory if calloc() fails. Found by cppcheck.
>
> Signed-off-by: Steve Beattie <steve at nxnw.org>
Acked-by: John Johansen <john.johansen at canonical.com>
> ---
> 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 AppArmor at lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
>
More information about the AppArmor
mailing list