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@xxxxxxxxxxxxxx> --- .../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 0c2edc67..e28833d2 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.31.1