Skip to contentSkip to conversation

qga: fix 'driver' leak in guest-get-fsinfo

PATCH Applied Marc-André Lureau 3 participants 3 messages Jul 5, 2018 – Jul 6, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qga: fix 'driver' leak in guest-get-fsinfo

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

Leak introduced by commit 743c71d03c20d64f2bae5fba6f26cdf5e4b1bda6, spotted by ASAN.

---
 qga/commands-posix.c | 1 +
 1 file changed, 1 insertion(+)
qga/commands-posix.c +1 -0
index 233f78a406..c46767b0dd 100644
@@ -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;
Signature · 1 line
2.18.0.rc1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Marc-André Lureau

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

Leak introduced by commit 743c71d03c20d64f2bae5fba6f26cdf5e4b1bda6, spotted by ASAN.

---
 qga/commands-posix.c | 1 +
 1 file changed, 1 insertion(+)
qga/commands-posix.c +0 -0
index 233f78a406..c46767b0dd 100644

qga/commands-posix.c static void build_guest_fsinfo_for_real_device(char const *syspath, · line 896

Quoted 7 lines
qga/commands-posix.c +1 -0
@@ -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;

Sorry, I should have noticed this in review.

Laszlo

Applied
#2 lore raw
In reply to Marc-André Lureau

Quoting Marc-André Lureau (2018-07-05 11:16:29)

Quoted 6 lines

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

Leak introduced by commit 743c71d03c20d64f2bae5fba6f26cdf5e4b1bda6, spotted by ASAN.

Thanks, applied to qga tree:
https://github.com/mdroth/qemu/commits/qga

Quoted 19 lines
---
 qga/commands-posix.c | 1 +
 1 file changed, 1 insertion(+)
qga/commands-posix.c +1 -0
index 233f78a406..c46767b0dd 100644
@@ -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;
Signature · 1 line
2.18.0.rc1