diff options
author | Laurent Vivier <laurent@vivier.eu> | 2016-01-18 23:50:45 +0100 |
---|---|---|
committer | Riku Voipio <riku.voipio@linaro.org> | 2016-02-23 21:25:09 +0200 |
commit | 5089c7ce82a49e6a97c5cf3db57a89bca8ed25d8 (patch) | |
tree | b889a01da044cda60eadd23cb79c8bbb856bc5e5 /linux-user | |
parent | 1b1624092d1f1f746adea6e1237a07f6788c2e3d (diff) |
linux-user: fix realloc size of target_fd_trans.
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>
Diffstat (limited to 'linux-user')
-rw-r--r-- | linux-user/syscall.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 54ce14a611..dac5518a07 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 *)); } |