aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2015-10-09 17:56:38 +0200
committerMichael Tokarev <mjt@tls.msk.ru>2015-11-06 15:42:38 +0300
commite9d49d518d5d2b0411ee2625e46662a6065a909c (patch)
tree99cc1825086ba0fbe7c373d71a30bb9bebd8f223 /linux-user
parent112317867d573bb053d431f098060cf996d9b2e8 (diff)
downloadqemu-e9d49d518d5d2b0411ee2625e46662a6065a909c.zip
qemu-e9d49d518d5d2b0411ee2625e46662a6065a909c.tar.gz
qemu-e9d49d518d5d2b0411ee2625e46662a6065a909c.tar.bz2
linux-user/syscall: Replace g_malloc0 + memcpy with g_memdup
No need to use g_malloc0 to zero the memory if we memcpy to the whole buffer afterwards anyway. Actually, there is even a function which combines both steps, g_memdup, so let's use this function here instead. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/syscall.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 8bfb24f..6c64ba6 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5325,8 +5325,7 @@ static abi_long do_open_by_handle_at(abi_long mount_fd, abi_long handle,
return -TARGET_EFAULT;
}
- fh = g_malloc0(total_size);
- memcpy(fh, target_fh, total_size);
+ fh = g_memdup(target_fh, total_size);
fh->handle_bytes = size;
fh->handle_type = tswap32(target_fh->handle_type);