mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-01 23:05:11 +00:00
binutils: fix resource leak on aa-load
Dir "d" is not closed when asprintf fails. Found by coverity: CID 321416: Resource leaks (RESOURCE_LEAK) Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
This commit is contained in:
@@ -179,6 +179,7 @@ static int load_policy_dir(const char *dir_path)
|
|||||||
}
|
}
|
||||||
if (asprintf(&file, "%s/%s", dir_path, dir->d_name) == -1) {
|
if (asprintf(&file, "%s/%s", dir_path, dir->d_name) == -1) {
|
||||||
error("Failure allocating memory");
|
error("Failure allocating memory");
|
||||||
|
closedir(d);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
load_policy_file(file);
|
load_policy_file(file);
|
||||||
|
Reference in New Issue
Block a user