From: Markus Armbruster Date: Fri, 21 Feb 2014 12:36:49 +0000 (+0100) Subject: qga: Fix memory allocation pasto X-Git-Tag: v1.7.1~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4736fb34f7d6ca2962c0a943ca4835fd25ca6140;p=thirdparty%2Fqemu.git 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 Reviewed-by: Eric Blake Signed-off-by: Michael Roth (cherry picked from commit 10b7c5dd0da1a92182e87f5fc1887d779ad1a9e8) Signed-off-by: Michael Roth --- diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 8100bee67e9..8763308cac3 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -525,7 +525,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); }