mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 12:09:58 +00:00
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>
This commit is contained in:
parent
1b1624092d
commit
5089c7ce82
@ -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 *));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user