mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 01:57:43 +00:00
parser - fix more memory leaks
This patch fixes a few more parser memory leaks as identified by the simple valgrind test script. These mostly occur during cleanup of structs and classes and as such, don't represent very serious leaks for common usages of the parser. Signed-off-by: Steve Beattie <steve@nxnw.org> Acked-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
a5bf039819
commit
3d26d2431c
@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
||||
* NOVELL (All rights reserved)
|
||||
* Copyright (c) 2010 - 2012
|
||||
* Canonical Ltd.
|
||||
* Copyright (c) 2010 - 2013
|
||||
* Canonical Ltd. (All rights reserved)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
@ -167,8 +167,10 @@ static int include_dir_cb(__unused DIR *dir, const char *name, struct stat *st,
|
||||
if (asprintf(&path, "%s/%s", d->fullpath, name) < 0)
|
||||
yyerror("Out of memory");
|
||||
|
||||
if (is_blacklisted(name, path))
|
||||
if (is_blacklisted(name, path)) {
|
||||
free(path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (S_ISREG(st->st_mode)) {
|
||||
if (!(yyin = fopen(path,"r")))
|
||||
|
@ -2,6 +2,9 @@
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
||||
* NOVELL (All rights reserved)
|
||||
*
|
||||
* Copyright (c) 2013
|
||||
* Canonical Ltd. (All rights reserved)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License published by the Free Software Foundation.
|
||||
@ -874,6 +877,8 @@ void free_cod_entries(struct cod_entry *list)
|
||||
free(list->name);
|
||||
if (list->link_name)
|
||||
free(list->link_name);
|
||||
if (list->nt_name)
|
||||
free(list->nt_name);
|
||||
if (list->pat.regex)
|
||||
free(list->pat.regex);
|
||||
free(list);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012
|
||||
* Copyright (c) 2012, 2013
|
||||
* Canonical, Ltd. (All rights reserved)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@ -72,12 +72,17 @@ Profile::~Profile()
|
||||
aare_delete_ruleset(policy.rules);
|
||||
if (policy.dfa)
|
||||
free(policy.dfa);
|
||||
if (xmatch)
|
||||
free(xmatch);
|
||||
if (name)
|
||||
free(name);
|
||||
if (attachment)
|
||||
free(attachment);
|
||||
if (ns)
|
||||
free(ns);
|
||||
for (int i = (AA_EXEC_LOCAL >> 10) + 1; i < AA_EXEC_COUNT; i++)
|
||||
if (exec_table[i])
|
||||
free(exec_table[i]);
|
||||
if (net.allow)
|
||||
free(net.allow);
|
||||
if (net.audit)
|
||||
|
Loading…
x
Reference in New Issue
Block a user