Skip to contentSkip to conversation

block/blkdebug: fix memory leak

PATCH Applied Elena Afanasova 3 participants 3 messages Oct 9, 2020 – Oct 12, 2020 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block/blkdebug: fix memory leak

Spotted by PVS-Studio

---
 block/blkdebug.c | 1 +
 1 file changed, 1 insertion(+)
block/blkdebug.c +1 -0
index eecbf3e5c4..54da719dd1 100644
@@ -215,6 +215,7 @@ static int add_rule(void *opaque, QemuOpts *opts, Error **errp)
                                  BLKDEBUG_IO_TYPE__MAX, &local_error);
         if (local_error) {
             error_propagate(errp, local_error);
+            g_free(rule);
             return -1;
         }
         if (iotype != BLKDEBUG_IO_TYPE__MAX) {
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Elena Afanasova

Spotted by PVS-Studio

---
 block/blkdebug.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 14 lines
block/blkdebug.c +1 -0
index eecbf3e5c4..54da719dd1 100644
@@ -215,6 +215,7 @@ static int add_rule(void *opaque, QemuOpts *opts, Error **errp)
                                  BLKDEBUG_IO_TYPE__MAX, &local_error);
         if (local_error) {
             error_propagate(errp, local_error);
+            g_free(rule);
             return -1;
         }
         if (iotype != BLKDEBUG_IO_TYPE__MAX) {
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#2 lore raw
In reply to Elena Afanasova

Le 09/10/2020 à 21:09, Elena Afanasova a écrit :

Quoted 13 lines

Spotted by PVS-Studio

---
 block/blkdebug.c | 1 +
 1 file changed, 1 insertion(+)
block/blkdebug.c +0 -0
index eecbf3e5c4..54da719dd1 100644

block/blkdebug.c static int add_rule(void *opaque, QemuOpts *opts, Error **errp) · line 221

Quoted 7 lines
block/blkdebug.c +1 -0
@@ -215,6 +215,7 @@ static int add_rule(void *opaque, QemuOpts *opts, Error **errp)
                                  BLKDEBUG_IO_TYPE__MAX, &local_error);
         if (local_error) {
             error_propagate(errp, local_error);
+            g_free(rule);
             return -1;
         }
         if (iotype != BLKDEBUG_IO_TYPE__MAX) {

Applied to my trivial-patches branch.

Thanks,
Laurent