]> git.proxmox.com Git - qemu.git/commitdiff
acl: Fix acl_remove not to mess up the ACL
authorMarkus Armbruster <armbru@redhat.com>
Tue, 15 Jan 2013 14:24:15 +0000 (15:24 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 16 Jan 2013 00:25:41 +0000 (18:25 -0600)
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>
util/acl.c

index 81ac25599b5dfd24e0091e47c4983211f46cd6cc..21b2205fa1cfd3fa7b61446486b9ead3ec320b33 100644 (file)
@@ -168,6 +168,9 @@ int qemu_acl_remove(qemu_acl *acl,
         i++;
         if (strcmp(entry->match, match) == 0) {
             QTAILQ_REMOVE(&acl->entries, entry, next);
+            acl->nentries--;
+            g_free(entry->match);
+            g_free(entry);
             return i;
         }
     }