]> git.proxmox.com Git - mirror_qemu.git/commitdiff
linux-user: fix realloc size of target_fd_trans.
authorLaurent Vivier <laurent@vivier.eu>
Mon, 18 Jan 2016 22:50:45 +0000 (23:50 +0100)
committerRiku Voipio <riku.voipio@linaro.org>
Tue, 23 Feb 2016 19:25:09 +0000 (21:25 +0200)
target_fd_trans is an array of "TargetFdTrans *": compute size
accordingly. Use g_renew() as proposed by Paolo.

Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user/syscall.c

index 54ce14a6113151ba925f50cd90b4343ab9b052d7..dac5518a074914794cdfb9552dbee0408c8c06f4 100644 (file)
@@ -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 *));
     }