qga: Fix memory allocation pasto
authorMarkus Armbruster <armbru@redhat.com>
Fri, 21 Feb 2014 12:36:49 +0000 (13:36 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Sun, 23 Feb 2014 19:13:52 +0000 (13:13 -0600)
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>
qga/commands-posix.c

index 91885604c4713142bad679b3fd2e3b7aeb92968b..6b5f11f83f9bcb140fc5f0d42f1f7ad477654f71 100644 (file)
@@ -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);
     }