[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 06/17] Avoid leak in qemuParseRBDString on failure of qemuAddRBDHost



From: "Daniel P. Berrange" <berrange redhat com>

If qemuAddRBDHost fails due to parsing problems or OOM, then
qemuParseRBDString cleanup is skipped causing a memory leak.

Signed-off-by: Daniel P. Berrange <berrange redhat com>
---
 src/qemu/qemu_command.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3296d09..bf07bdc 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3325,9 +3325,9 @@ static int qemuParseRBDString(virDomainDiskDefPtr disk)
                         break;
                     }
                 }
-                if (qemuAddRBDHost(disk, h) < 0) {
-                    return -1;
-                }
+                if (qemuAddRBDHost(disk, h) < 0)
+                    goto error;
+
                 h = sep;
             }
         }
-- 
1.8.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]