libsepol: fix memory leak in sepol_bool_query()

When sepol_bool_query() returns NULL response, variable name is not
freed. Fix this by calling free() before returning.

Signed-off-by: Jan Zarsky <jzarsky@redhat.com>
This commit is contained in:
Jan Zarsky 2017-09-13 10:16:42 +02:00 committed by Stephen Smalley
parent 7e9d1344db
commit 77059c39e8

View File

@ -155,6 +155,7 @@ int sepol_bool_query(sepol_handle_t * handle,
booldatum = hashtab_search(policydb->p_bools.table, name); booldatum = hashtab_search(policydb->p_bools.table, name);
if (!booldatum) { if (!booldatum) {
*response = NULL; *response = NULL;
free(name);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }