libsemanage: fcontext_record: do not leak on error in semanage_fcontext_key_create

If the strdup failed, we would return without freeing tmp_key.  This is
obviously a memory leak.  So free that if we are finished with it.

Signed-off-by: Eric Paris <eparis@redhat.com>
This commit is contained in:
Eric Paris 2013-02-05 14:12:15 -05:00
parent 7d83d86ba1
commit d0c7f6ea4f

View File

@ -48,6 +48,7 @@ int semanage_fcontext_key_create(semanage_handle_t * handle,
tmp_key->expr = strdup(expr);
if (!tmp_key->expr) {
ERR(handle, "out of memory, could not create file context key.");
free(tmp_key);
return STATUS_ERR;
}
tmp_key->type = type;