aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-06-29 15:11:50 +0200
committerGreg Kurz <groug@kaod.org>2017-06-29 15:11:50 +0200
commit453a1b234fc11570e332e91d58e4dbfeec7cb824 (patch)
tree1d793f5b6a236ab1a4bc297f1216edf6b4e462da /hw/9pfs
parentb96feb2cb9b2714bffa342b1d4f39d8db71329ba (diff)
9pfs: replace g_malloc()+memcpy() with g_memdup()
I found these pattern via grepping the source tree. I don't have a coccinelle script for it! Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'hw/9pfs')
-rw-r--r--hw/9pfs/9p-synth.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c
index 4b6d4e6a3f..df0a8de08a 100644
--- a/hw/9pfs/9p-synth.c
+++ b/hw/9pfs/9p-synth.c
@@ -494,8 +494,7 @@ static int synth_name_to_path(FsContext *ctx, V9fsPath *dir_path,
}
out:
/* Copy the node pointer to fid */
- target->data = g_malloc(sizeof(void *));
- memcpy(target->data, &node, sizeof(void *));
+ target->data = g_memdup(&node, sizeof(void *));
target->size = sizeof(void *);
return 0;
}