libsemanage: Free contents of modkey in semanage_direct_remove

semanage_direct_remove allocates struct semanage_module_key_t on
stack, then calls semanage_module_key_set_name which allocates
modkey->name on heap, but modkey->name wasn't free()-d anywhere,
creating a small leak.

Signed-off-by: Jakub Hrozek <jhrozek@redhat.com>
This commit is contained in:
Jakub Hrozek 2020-12-17 15:59:49 +01:00 committed by Nicolas Iooss
parent af3e6789f0
commit edae9275f6
No known key found for this signature in database
GPG key ID: C191415F340DAAA0

View file

@ -1951,6 +1951,7 @@ static int semanage_direct_remove(semanage_handle_t * sh, char *module_name)
status = semanage_direct_remove_key(sh, &modkey);
cleanup:
semanage_module_key_destroy(sh, &modkey);
return status;
}