mirror of
https://github.com/SELinuxProject/selinux
synced 2025-03-08 03:07:33 +00:00
libsepol: do not seg fault on sepol_*_key_free(NULL)
sepol_*_key_free(NULL) should just be a no-op just like free(NULL). Fix several instances that did not handle this correctly and would seg fault if called with NULL. Test: setsebool -P zebra_write_config=1 while non-root Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
This commit is contained in:
parent
92f22e193a
commit
e6edc42455
@ -67,6 +67,8 @@ int sepol_bool_key_extract(sepol_handle_t * handle,
|
||||
|
||||
void sepol_bool_key_free(sepol_bool_key_t * key)
|
||||
{
|
||||
if (!key)
|
||||
return;
|
||||
free(key->name);
|
||||
free(key);
|
||||
}
|
||||
|
@ -73,6 +73,8 @@ int sepol_iface_key_extract(sepol_handle_t * handle,
|
||||
|
||||
void sepol_iface_key_free(sepol_iface_key_t * key)
|
||||
{
|
||||
if (!key)
|
||||
return;
|
||||
free(key->name);
|
||||
free(key);
|
||||
}
|
||||
|
@ -76,6 +76,8 @@ int sepol_user_key_extract(sepol_handle_t * handle,
|
||||
|
||||
void sepol_user_key_free(sepol_user_key_t * key)
|
||||
{
|
||||
if (!key)
|
||||
return;
|
||||
free(key->name);
|
||||
free(key);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user