From b0902a34d1cde1b23290d451f6b332aa2318a490 Mon Sep 17 00:00:00 2001 From: Georgia Garcia Date: Fri, 30 Jun 2023 10:00:29 -0300 Subject: [PATCH] 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 --- binutils/aa_load.c | 1 + 1 file changed, 1 insertion(+) diff --git a/binutils/aa_load.c b/binutils/aa_load.c index ea4dc7c23..a66efd3f5 100644 --- a/binutils/aa_load.c +++ b/binutils/aa_load.c @@ -179,6 +179,7 @@ static int load_policy_dir(const char *dir_path) } if (asprintf(&file, "%s/%s", dir_path, dir->d_name) == -1) { error("Failure allocating memory"); + closedir(d); return -1; } load_policy_file(file);