* [Qemu-devel] [PATCH] qga: Fix memory allocation pasto
@ 2014-02-21 12:36 Markus Armbruster
2014-02-21 13:44 ` Eric Blake
2014-02-24 1:01 ` Michael Roth
0 siblings, 2 replies; 3+ messages in thread
From: Markus Armbruster @ 2014-02-21 12:36 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, mdroth
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(-)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index cae4171..2c496b6 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);
}
--
1.8.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] qga: Fix memory allocation pasto
2014-02-21 12:36 [Qemu-devel] [PATCH] qga: Fix memory allocation pasto Markus Armbruster
@ 2014-02-21 13:44 ` Eric Blake
2014-02-24 1:01 ` Michael Roth
1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2014-02-21 13:44 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel; +Cc: qemu-trivial, mdroth
[-- Attachment #1: Type: text/plain, Size: 1112 bytes --]
On 02/21/2014 05:36 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 cae4171..2c496b6 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);
> }
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] qga: Fix memory allocation pasto
2014-02-21 12:36 [Qemu-devel] [PATCH] qga: Fix memory allocation pasto Markus Armbruster
2014-02-21 13:44 ` Eric Blake
@ 2014-02-24 1:01 ` Michael Roth
1 sibling, 0 replies; 3+ messages in thread
From: Michael Roth @ 2014-02-24 1:01 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel; +Cc: qemu-trivial
Quoting Markus Armbruster (2014-02-21 06:36:49)
> 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>
Thanks, applied to qga tree:
https://github.com/mdroth/qemu/commits/qga
> ---
> qga/commands-posix.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index cae4171..2c496b6 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);
> }
> --
> 1.8.1.4
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-24 1:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-21 12:36 [Qemu-devel] [PATCH] qga: Fix memory allocation pasto Markus Armbruster
2014-02-21 13:44 ` Eric Blake
2014-02-24 1:01 ` Michael Roth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).