ae23c9
From bc451d7850fab973418fa083527b59f7d4fe1779 Mon Sep 17 00:00:00 2001
ae23c9
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
ae23c9
Date: Tue, 5 Feb 2019 11:25:51 +0000
ae23c9
Subject: [PATCH 2/2] qga: fix 'driver' leak in guest-get-fsinfo
ae23c9
MIME-Version: 1.0
ae23c9
Content-Type: text/plain; charset=UTF-8
ae23c9
Content-Transfer-Encoding: 8bit
ae23c9
ae23c9
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
ae23c9
Message-id: <20190205112551.14763-3-marcandre.lureau@redhat.com>
ae23c9
Patchwork-id: 84242
ae23c9
O-Subject: [RHEL8/rhel qemu-kvm PATCH 2/2] qga: fix 'driver' leak in guest-get-fsinfo
ae23c9
Bugzilla: 1666952
ae23c9
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
ae23c9
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
ae23c9
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
ae23c9
ae23c9
'driver' is leaked when the loop is not broken.
ae23c9
ae23c9
Leak introduced by commit 743c71d03c20d64f2bae5fba6f26cdf5e4b1bda6,
ae23c9
spotted by ASAN.
ae23c9
ae23c9
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
ae23c9
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
ae23c9
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
ae23c9
ae23c9
(cherry picked from commit bb23a7362a7942739f080990a53e44afc319e36c)
ae23c9
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 qga/commands-posix.c | 1 +
ae23c9
 1 file changed, 1 insertion(+)
ae23c9
ae23c9
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
ae23c9
index 71cb644..28b1c4c 100644
ae23c9
--- a/qga/commands-posix.c
ae23c9
+++ b/qga/commands-posix.c
ae23c9
@@ -897,6 +897,7 @@ static void build_guest_fsinfo_for_real_device(char const *syspath,
ae23c9
             break;
ae23c9
         }
ae23c9
 
ae23c9
+        g_free(driver);
ae23c9
         if (sscanf(p, "/%x:%x:%x.%x%n",
ae23c9
                           pci, pci + 1, pci + 2, pci + 3, &pcilen) == 4) {
ae23c9
             p += pcilen;
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9