From 57d2a0742d2e37089a848e843203c7783ea9902e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Wed, 18 Jul 2018 12:56:42 +0200
Subject: [PATCH 2/2] qga: fix 'driver' leak in guest-get-fsinfo
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: <20180718125642.11815-3-marcandre.lureau@redhat.com>
Patchwork-id: 81389
O-Subject: [RHEL-7.6 qemu-guest-agent PATCH 2/2] qga: fix 'driver' leak in guest-get-fsinfo
Bugzilla: 1567041
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@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>
(cherry picked from commit bb23a7362a7942739f080990a53e44afc319e36c)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
qga/commands-posix.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 624b0dc..26c1863 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -889,6 +889,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;
--
1.8.3.1