diff options
author | Laurent Vivier <laurent@vivier.eu> | 2016-01-18 23:50:45 +0100 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-11-29 19:45:58 -0600 |
commit | 1cc2a5b9298451b07792178329a4fde7b0fcc72c (patch) | |
tree | 2e4305cb7ef7e6c7ed083aefcf7c24e82eb3602b | |
parent | 281ca2e6f09ea57d8041989672664f9c442b4d51 (diff) | |
download | hqemu-1cc2a5b9298451b07792178329a4fde7b0fcc72c.zip hqemu-1cc2a5b9298451b07792178329a4fde7b0fcc72c.tar.gz |
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>
-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 ae16b85..4333e54 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -319,8 +319,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 *)); } |