qssb_free_policy(): Allow passing NULL

这个提交包含在:
Albert S. 2021-06-08 12:35:07 +02:00
父节点 55ec51ba21
当前提交 a585db7778
共有 1 个文件被更改,包括 9 次插入6 次删除

15
qssb.h
查看文件

@ -417,14 +417,17 @@ static int mount_to_chroot(const char *chroot_target_path, struct qssb_path_poli
*/
void qssb_free_policy(struct qssb_policy *ctxt)
{
struct qssb_path_policy *current = ctxt->path_policies;
while(current)
if(ctxt != NULL)
{
struct qssb_path_policy *tmp = current;
current = current->next;
free(tmp);
struct qssb_path_policy *current = ctxt->path_policies;
while(current != NULL)
{
struct qssb_path_policy *tmp = current;
current = current->next;
free(tmp);
}
free(ctxt);
}
free(ctxt);
}
/* Enters the specified namespaces */