diff mbox series

[PULL,for-3.0,1/2] qga: fix 'driver' leak in guest-get-fsinfo

Message ID 20180716214450.17758-2-mdroth@linux.vnet.ibm.com
State New
Headers show
Series [PULL,for-3.0,1/2] qga: fix 'driver' leak in guest-get-fsinfo | expand

Commit Message

Michael Roth July 16, 2018, 9:44 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

'driver' is leaked when the loop is not broken.

Leak introduced by commit 743c71d03c20d64f2bae5fba6f26cdf5e4b1bda6,
spotted by ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qga/commands-posix.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 233f78a406..c46767b0dd 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -890,6 +890,7 @@  static void build_guest_fsinfo_for_real_device(char const *syspath,
             break;
         }
 
+        g_free(driver);
         if (sscanf(p, "/%x:%x:%x.%x%n",
                           pci, pci + 1, pci + 2, pci + 3, &pcilen) == 4) {
             p += pcilen;