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>
This commit is contained in:
Marc-André Lureau 2017-06-29 15:11:50 +02:00 committed by Greg Kurz
parent b96feb2cb9
commit 453a1b234f

View File

@ -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;
}