From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQZk7-0003Eb-1M for qemu-devel@nongnu.org; Thu, 29 Jun 2017 09:44:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQZk2-0002tF-Fi for qemu-devel@nongnu.org; Thu, 29 Jun 2017 09:44:23 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:41442 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dQZk2-0002sz-9O for qemu-devel@nongnu.org; Thu, 29 Jun 2017 09:44:18 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v5TDcr2x124544 for ; Thu, 29 Jun 2017 09:44:17 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2bcyr8867s-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 29 Jun 2017 09:44:16 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 29 Jun 2017 14:44:14 +0100 From: Greg Kurz Date: Thu, 29 Jun 2017 15:43:46 +0200 In-Reply-To: <1498743831-28676-1-git-send-email-groug@kaod.org> References: <1498743831-28676-1-git-send-email-groug@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Message-Id: <1498743831-28676-4-git-send-email-groug@kaod.org> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 3/8] 9pfs: replace g_malloc()+memcpy() with g_memdup() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Greg Kurz , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= From: Marc-Andr=C3=A9 Lureau I found these pattern via grepping the source tree. I don't have a coccinelle script for it! Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/9pfs/9p-synth.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c index 4b6d4e6a3f1c..df0a8de08aed 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, V9fsPat= h *dir_path, } out: /* Copy the node pointer to fid */ - target->data =3D g_malloc(sizeof(void *)); - memcpy(target->data, &node, sizeof(void *)); + target->data =3D g_memdup(&node, sizeof(void *)); target->size =3D sizeof(void *); return 0; } --=20 2.7.5