ae2afb9386
Rebase on upstream commit 32611aea6543 See $ cd SELinuxProject/selinux $ git log --pretty=oneline libsepol-3.2..32611aea6543 -- libsepol
52 lines
1.6 KiB
Diff
52 lines
1.6 KiB
Diff
From d0c02882b7fdcf5e6478f9a82ac2946174f4bca4 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
|
|
Date: Mon, 3 May 2021 17:10:53 +0200
|
|
Subject: [PATCH] libselinux: selabel_get_digests_all_partial_matches: free
|
|
memory after FTS_D block
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Free all memory from `selabel_get_digests_all_partial_matches()` in case
|
|
of success and failure.
|
|
|
|
Found by clang-analyzer.
|
|
|
|
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
|
|
---
|
|
.../utils/selabel_get_digests_all_partial_matches.c | 10 +++++-----
|
|
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/libselinux/utils/selabel_get_digests_all_partial_matches.c b/libselinux/utils/selabel_get_digests_all_partial_matches.c
|
|
index 0c2edc67771d..e28833d2ce97 100644
|
|
--- a/libselinux/utils/selabel_get_digests_all_partial_matches.c
|
|
+++ b/libselinux/utils/selabel_get_digests_all_partial_matches.c
|
|
@@ -128,7 +128,7 @@ int main(int argc, char **argv)
|
|
printf("No SHA1 digest available for: %s\n",
|
|
ftsent->fts_path);
|
|
printf("as file_context entry is \"<<none>>\"\n");
|
|
- break;
|
|
+ goto cleanup;
|
|
}
|
|
|
|
printf("The file_context entries for: %s\n",
|
|
@@ -149,11 +149,11 @@ int main(int argc, char **argv)
|
|
xattr_digest[i]);
|
|
printf("%s\n", sha1_buf);
|
|
}
|
|
-
|
|
- free(xattr_digest);
|
|
- free(calculated_digest);
|
|
- free(sha1_buf);
|
|
}
|
|
+ cleanup:
|
|
+ free(xattr_digest);
|
|
+ free(calculated_digest);
|
|
+ free(sha1_buf);
|
|
break;
|
|
}
|
|
default:
|
|
--
|
|
2.32.0
|
|
|