acl: Fix acl_remove not to mess up the ACL
It leaks memory and fails to adjust qemu_acl member nentries. Future acl_add become confused: can misreport the position, and can silently fail to add. Cc: qemu-stable@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
cc69bda6c9
commit
c23c15d30b
@ -168,6 +168,9 @@ int qemu_acl_remove(qemu_acl *acl,
|
|||||||
i++;
|
i++;
|
||||||
if (strcmp(entry->match, match) == 0) {
|
if (strcmp(entry->match, match) == 0) {
|
||||||
QTAILQ_REMOVE(&acl->entries, entry, next);
|
QTAILQ_REMOVE(&acl->entries, entry, next);
|
||||||
|
acl->nentries--;
|
||||||
|
g_free(entry->match);
|
||||||
|
g_free(entry);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user