Message ID | 1391183604-21621-2-git-send-email-armbru@redhat.com |
---|---|
State | New |
Headers | show |
On 01/31/2014 08:53 AM, Markus Armbruster wrote: > 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> > --- > qga/commands-posix.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Eric Blake <eblake@redhat.com> > > diff --git a/qga/commands-posix.c b/qga/commands-posix.c > index 8100bee..8763308 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); > } >
diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 8100bee..8763308 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); }
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> --- qga/commands-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)