Skip to contentSkip to conversation

ACL fixes

PATCH Applied Markus Armbruster 2 participants 4 messages Jan 15, 2013 – Jan 16, 2013

lore
Share & tools
lore
#2 lore raw

PATCH 2/2 acl: Free memory allocated with g_malloc() with g_free()

In reply to Markus Armbruster
---
 util/acl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
util/acl.c +2 -2
index 21b2205..a7f33ff 100644
@@ -103,8 +103,8 @@ void qemu_acl_reset(qemu_acl *acl)
     acl->defaultDeny = 1;
     QTAILQ_FOREACH_SAFE(entry, &acl->entries, next, next_entry) {
         QTAILQ_REMOVE(&acl->entries, entry, next);
-        free(entry->match);
-        free(entry);
+        g_free(entry->match);
+        g_free(entry);
     }
     acl->nentries = 0;
 }
Signature · 1 line
1.7.11.7
#0 lore raw

cover ACL fixes

Markus Armbruster (2):
acl: Fix acl_remove not to mess up the ACL
acl: Free memory allocated with g_malloc() with g_free()

 util/acl.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH 1/2 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.

---
 util/acl.c | 3 +++
 1 file changed, 3 insertions(+)
util/acl.c +3 -0
index 81ac255..21b2205 100644
@@ -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;
         }
     }
Signature · 1 line
1.7.11.7