diff options
author | Daniel P. Berrangé | 2021-08-09 15:10:29 +0200 |
---|---|---|
committer | Michael Roth | 2021-08-10 03:18:43 +0200 |
commit | 057489dd1586612b99b4b98d211bf7f0a9d6f0e4 (patch) | |
tree | 3fb628e6180aa4c279ca7a1b5d61bf4334effc13 /qga | |
parent | Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-6.1-pull-re... (diff) | |
download | qemu-057489dd1586612b99b4b98d211bf7f0a9d6f0e4.tar.gz qemu-057489dd1586612b99b4b98d211bf7f0a9d6f0e4.tar.xz qemu-057489dd1586612b99b4b98d211bf7f0a9d6f0e4.zip |
qga: fix leak of base64 decoded data on command error
If the guest command fails to be spawned, then we would leak the decoded
base64 input used for the command's stdin feed.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
Diffstat (limited to 'qga')
-rw-r--r-- | qga/commands.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/qga/commands.c b/qga/commands.c index a6491d2cf8..80501e4a73 100644 --- a/qga/commands.c +++ b/qga/commands.c @@ -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); |