libsepol: fix memory leak in sepol_bool_query()
PATCH 1/1 libsepol: fix memory leak in sepol_bool_query()
From: Jan Zarsky <[email protected]>
When sepol_bool_query() returns NULL response, variable name is not freed. Fix this by calling free() before returning.
Signed-off-by Jan Zarsky <[email protected]>
--- libsepol/src/booleans.c | 1 + 1 file changed, 1 insertion(+)
libsepol/src/booleans.c +1 -0
@@ -155,6 +155,7 @@ int sepol_bool_query(sepol_handle_t * handle, booldatum =hashtab_search (policydb->p_bools.table, name);if (!booldatum) { *response =NULL ; +free (name);return STATUS_SUCCESS ; }
Signature · 1 line
2.9.5
Stephen Smalley
AppliedQuoted 6 lines · On Wed, 2017-09-13 at 10:16 +0200, [email protected] wrote:
From: Jan Zarsky <[email protected]>
When
sepol_bool_query()returns NULL response, variable name is not freed. Fix this by callingfree()before returning.Signed-off-by Jan Zarsky <[email protected]>
Thanks, applied.
Quoted 16 lines
---
libsepol/src/booleans.c | 1 +1 file changed, 1 insertion(+)libsepol/src/booleans.c +1
-0@@ -155,6 +155,7 @@ int sepol_bool_query(sepol_handle_t * handle, booldatum = hashtab_search(policydb->p_bools.table, name); if (!booldatum) { *response = NULL; +free (name); return STATUS_SUCCESS; }