diff mbox

checkpolicy: Fix minor memory leak in checkpolicy

Message ID 1490022873-11869-1-git-send-email-jwcart2@tycho.nsa.gov (mailing list archive)
State Not Applicable
Headers show

Commit Message

James Carter March 20, 2017, 3:14 p.m. UTC
sepol_set_sidtab() is called without calling sepol_sidtab_destroy().
This is not a big deal, since checkpolicy does not run for long, but
it does add noise when checking for other, more important, leaks.

Call sepol_sidtab_destroy() before exiting if not in debug mode.

Signed-off-by: James Carter <jwcart2@tycho.nsa.gov>
---
 checkpolicy/checkpolicy.c | 1 +
 1 file changed, 1 insertion(+)

Comments

James Carter March 21, 2017, 6:29 p.m. UTC | #1
On 03/20/2017 11:14 AM, James Carter wrote:
> sepol_set_sidtab() is called without calling sepol_sidtab_destroy().
> This is not a big deal, since checkpolicy does not run for long, but
> it does add noise when checking for other, more important, leaks.
>
> Call sepol_sidtab_destroy() before exiting if not in debug mode.
>
> Signed-off-by: James Carter <jwcart2@tycho.nsa.gov>

This has been applied.

> ---
>  checkpolicy/checkpolicy.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/checkpolicy/checkpolicy.c b/checkpolicy/checkpolicy.c
> index 442e7db..534fc22 100644
> --- a/checkpolicy/checkpolicy.c
> +++ b/checkpolicy/checkpolicy.c
> @@ -673,6 +673,7 @@ int main(int argc, char **argv)
>
>  	if (!debug) {
>  		policydb_destroy(&policydb);
> +		sepol_sidtab_destroy(&sidtab);
>  		exit(0);
>  	}
>
>
diff mbox

Patch

diff --git a/checkpolicy/checkpolicy.c b/checkpolicy/checkpolicy.c
index 442e7db..534fc22 100644
--- a/checkpolicy/checkpolicy.c
+++ b/checkpolicy/checkpolicy.c
@@ -673,6 +673,7 @@  int main(int argc, char **argv)
 
 	if (!debug) {
 		policydb_destroy(&policydb);
+		sepol_sidtab_destroy(&sidtab);
 		exit(0);
 	}