summaryrefslogtreecommitdiff
path: root/qga
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-02-21 13:36:49 +0100
committerMichael Roth <mdroth@linux.vnet.ibm.com>2014-02-23 13:13:52 -0600
commit10b7c5dd0da1a92182e87f5fc1887d779ad1a9e8 (patch)
treefb9539d7e73029f8de2b30b583a49efa0144a029 /qga
parent2c958923bc09b1faf2505a988b4b1c458580e9ac (diff)
downloadqemu-10b7c5dd0da1a92182e87f5fc1887d779ad1a9e8.tar.gz
qemu-10b7c5dd0da1a92182e87f5fc1887d779ad1a9e8.tar.bz2
qemu-10b7c5dd0da1a92182e87f5fc1887d779ad1a9e8.zip
qga: Fix memory allocation pasto
qmp_guest_file_seek() allocates memory for a GuestFileRead object instead of the GuestFileSeek object it actually uses. Harmless, because the GuestFileRead is slightly larger. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'qga')
-rw-r--r--qga/commands-posix.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 91885604c4..6b5f11f83f 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -534,7 +534,7 @@ struct GuestFileSeek *qmp_guest_file_seek(int64_t handle, int64_t offset,
if (ret == -1) {
error_setg_errno(err, errno, "failed to seek file");
} else {
- seek_data = g_malloc0(sizeof(GuestFileRead));
+ seek_data = g_new0(GuestFileSeek, 1);
seek_data->position = ftell(fh);
seek_data->eof = feof(fh);
}