From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYtfc-00051b-VC for qemu-devel@nongnu.org; Thu, 25 Feb 2016 06:01:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aYtfa-0000b2-IZ for qemu-devel@nongnu.org; Thu, 25 Feb 2016 06:01:20 -0500 Received: from mail-lf0-x232.google.com ([2a00:1450:4010:c07::232]:34517) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYtfa-0000as-9Q for qemu-devel@nongnu.org; Thu, 25 Feb 2016 06:01:18 -0500 Received: by mail-lf0-x232.google.com with SMTP id j78so30545104lfb.1 for ; Thu, 25 Feb 2016 03:01:18 -0800 (PST) From: riku.voipio@linaro.org Date: Thu, 25 Feb 2016 13:01:06 +0200 Message-Id: <5089c7ce82a49e6a97c5cf3db57a89bca8ed25d8.1456397907.git.riku.voipio@linaro.org> In-Reply-To: References: Subject: [Qemu-devel] [PULL v2 1/8] linux-user: fix realloc size of target_fd_trans. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Laurent Vivier From: Laurent Vivier target_fd_trans is an array of "TargetFdTrans *": compute size accordingly. Use g_renew() as proposed by Paolo. Reported-by: Paolo Bonzini Signed-off-by: Laurent Vivier Signed-off-by: Riku Voipio --- 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 54ce14a..dac5518 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -318,8 +318,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 *)); } -- 2.1.4