qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qga: Fix memory allocation pasto


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] qga: Fix memory allocation pasto
Date: Fri, 21 Feb 2014 06:44:02 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

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 <address@hidden>
> ---
>  qga/commands-posix.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Eric Blake <address@hidden>

> 
> 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: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]