summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2013-01-15 15:24:15 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2013-01-15 18:25:41 -0600
commitc23c15d30b901bb447cdcada96cae64c0046d146 (patch)
tree95aad50a067a49578ca3e2dc5dac5b54801cc3f3
parentcc69bda6c97a1c193348eb381f4bffdfd1c8a948 (diff)
downloadfocaccia-qemu-c23c15d30b901bb447cdcada96cae64c0046d146.tar.gz
focaccia-qemu-c23c15d30b901bb447cdcada96cae64c0046d146.zip
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>
-rw-r--r--util/acl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/acl.c b/util/acl.c
index 81ac25599b..21b2205fa1 100644
--- a/util/acl.c
+++ b/util/acl.c
@@ -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;
         }
     }