Skip to contentSkip to conversation

qemu-ga patch queue for hard-freeze/rc3

GIT PULL Applied Michael Roth 2 participants 3 messages Aug 10, 2021

lore
Share & tools
lore
#0 lore raw

Hi Peter,

This is a single fix for a potentially recurring memory leak in the guest agent. If you don't think it is rc3 material I can save it for 6.2, but if possible this would be good to have in.

The following changes since commit dee64246ded3aa7dbada68b96ce1c64e5bea327d:

Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-6.1-pull-request' into staging (2021-08-06 10:28:33 +0100)

are available in the Git repository at:

git://github.com/mdroth/qemu.git tags/qga-pull-2021-08-09-tag

for you to fetch changes up to 057489dd1586612b99b4b98d211bf7f0a9d6f0e4:

qga: fix leak of base64 decoded data on command error (2021-08-09 20:18:43 -0500)

----------------------------------------------------------------
qemu-ga patch queue for hard-freeze

* fix memory leak in guest_exec

----------------------------------------------------------------
Daniel P. Berrangé (1):
qga: fix leak of base64 decoded data on command error

 qga/commands.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
#1 lore raw

[PULL for-6.1 1/1] qga: fix leak of base64 decoded data on command error

From: Daniel P. Berrangé <[email protected]>

If the guest command fails to be spawned, then we would leak the decoded base64 input used for the command's stdin feed.

---
 qga/commands.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
qga/commands.c +2 -2
index a6491d2cf8..80501e4a73 100644
@@ -402,7 +402,7 @@ GuestExec *qmp_guest_exec(const char *path,
     GIOChannel *in_ch, *out_ch, *err_ch;
     GSpawnFlags flags;
     bool has_output = (has_capture_output && capture_output);
-    uint8_t *input = NULL;
+    g_autofree uint8_t *input = NULL;
     size_t ninput = 0;
 
     arglist.value = (char *)path;
@@ -441,7 +441,7 @@ GuestExec *qmp_guest_exec(const char *path,
     g_child_watch_add(pid, guest_exec_child_watch, gei);
 
     if (has_input_data) {
-        gei->in.data = input;
+        gei->in.data = g_steal_pointer(&input);
         gei->in.size = ninput;
 #ifdef G_OS_WIN32
         in_ch = g_io_channel_win32_new_fd(in_fd);
Signature · 1 line
2.25.1
#2 lore raw
In reply to Michael Roth
Quoted 15 lines · Michael Roth

Hi Peter,

This is a single fix for a potentially recurring memory leak in the guest agent. If you don't think it is rc3 material I can save it for 6.2, but if possible this would be good to have in.

The following changes since commit dee64246ded3aa7dbada68b96ce1c64e5bea327d:

Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-6.1-pull-request' into staging (2021-08-06 10:28:33 +0100)

are available in the Git repository at:

git://github.com/mdroth/qemu.git tags/qga-pull-2021-08-09-tag

Quoted 9 lines

for you to fetch changes up to 057489dd1586612b99b4b98d211bf7f0a9d6f0e4:

qga: fix leak of base64 decoded data on command error (2021-08-09 20:18:43 -0500)

----------------------------------------------------------------
qemu-ga patch queue for hard-freeze

* fix memory leak in guest_exec

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/6.1
for any user-visible changes.

-- PMM