qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] linux-user: fix realloc size of target_fd_trans


From: Laurent Vivier
Subject: Re: [Qemu-devel] [PATCH] linux-user: fix realloc size of target_fd_trans.
Date: Mon, 1 Feb 2016 14:40:09 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

Ping ?

Le 18/01/2016 23:50, Laurent Vivier a écrit :
> target_fd_trans is an array of "TargetFdTrans *": compute size
> accordingly. Use g_renew() as proposed by Paolo.
> 
> Reported-by: Paolo Bonzini <address@hidden>
> Signed-off-by: Laurent Vivier <address@hidden>
> ---
>  linux-user/syscall.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 0cbace4..fd04e5f 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -330,8 +330,8 @@ static void fd_trans_register(int fd, TargetFdTrans 
> *trans)
>      if (fd >= target_fd_max) {
>          oldmax = target_fd_max;
>          target_fd_max = ((fd >> 6) + 1) << 6; /* by slice of 64 entries */
> -        target_fd_trans = g_realloc(target_fd_trans,
> -                                    target_fd_max * sizeof(TargetFdTrans));
> +        target_fd_trans = g_renew(TargetFdTrans *,
> +                                  target_fd_trans, target_fd_max);
>          memset((void *)(target_fd_trans + oldmax), 0,
>                 (target_fd_max - oldmax) * sizeof(TargetFdTrans *));
>      }
> 



reply via email to

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