qga: fix 'driver' leak in guest-get-fsinfo
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 5 Jul 2018 16:16:29 +0000 (18:16 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 16 Jul 2018 17:51:32 +0000 (12:51 -0500)
'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

index 233f78a40623089cc4bdecb8e8b7dc08a11f03aa..c46767b0dd117cd21e55f65e1fd955d11493ed63 100644 (file)
@@ -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;