libselinux: selabel_get_digests_all_partial_matches: free memory after FTS_D block

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>
This commit is contained in:
Christian Göttsche 2021-05-03 17:10:53 +02:00 committed by Petr Lautrbach
parent 7464272caa
commit d0c02882b7

View file

@ -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: