qssb_free_policy(): Allow passing NULL

Esse commit está contido em:
Albert S. 2021-06-08 12:35:07 +02:00
commit a585db7778

5
qssb.h
Ver arquivo

@ -416,9 +416,11 @@ static int mount_to_chroot(const char *chroot_target_path, struct qssb_path_poli
* Frees the memory taken by a qssb_policy object * Frees the memory taken by a qssb_policy object
*/ */
void qssb_free_policy(struct qssb_policy *ctxt) void qssb_free_policy(struct qssb_policy *ctxt)
{
if(ctxt != NULL)
{ {
struct qssb_path_policy *current = ctxt->path_policies; struct qssb_path_policy *current = ctxt->path_policies;
while(current) while(current != NULL)
{ {
struct qssb_path_policy *tmp = current; struct qssb_path_policy *tmp = current;
current = current->next; current = current->next;
@ -426,6 +428,7 @@ void qssb_free_policy(struct qssb_policy *ctxt)
} }
free(ctxt); free(ctxt);
} }
}
/* Enters the specified namespaces */ /* Enters the specified namespaces */
static int enter_namespaces(int namespace_options) static int enter_namespaces(int namespace_options)