From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNfVx-0004rn-LD for qemu-devel@nongnu.org; Thu, 14 Jul 2016 08:13:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNfVt-00077B-1O for qemu-devel@nongnu.org; Thu, 14 Jul 2016 08:13:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35457) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNfVs-000776-RY for qemu-devel@nongnu.org; Thu, 14 Jul 2016 08:13:08 -0400 References: <1459997185-15669-1-git-send-email-weijg.fnst@cn.fujitsu.com> <1459997185-15669-2-git-send-email-weijg.fnst@cn.fujitsu.com> From: Paolo Bonzini Message-ID: <38e9c5ee-89e7-295b-9983-3b19db14e740@redhat.com> Date: Thu, 14 Jul 2016 14:13:05 +0200 MIME-Version: 1.0 In-Reply-To: <1459997185-15669-2-git-send-email-weijg.fnst@cn.fujitsu.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/3] linux-user: complete omission of removing uses of strdup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wei Jiangang , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Riku Voipio On 07/04/2016 04:46, Wei Jiangang wrote: > The 900cfbc just removed two unchecked uses of strdup > in fill_psinfo and missed the rest in core_dump_filename. > This patch fixes it. >=20 > Signed-off-by: Wei Jiangang > --- > linux-user/elfload.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) >=20 > diff --git a/linux-user/elfload.c b/linux-user/elfload.c > index e47caff..6373320 100644 > --- a/linux-user/elfload.c > +++ b/linux-user/elfload.c > @@ -2718,7 +2718,6 @@ static int core_dump_filename(const TaskState *ts= , char *buf, > size_t bufsize) > { > char timestamp[64]; > - char *filename =3D NULL; > char *base_filename =3D NULL; > struct timeval tv; > struct tm tm; > @@ -2731,14 +2730,12 @@ static int core_dump_filename(const TaskState *= ts, char *buf, > return (-1); > } > =20 > - filename =3D strdup(ts->bprm->filename); > - base_filename =3D strdup(basename(filename)); > + base_filename =3D g_path_get_basename(ts->bprm->filename); > (void) strftime(timestamp, sizeof (timestamp), "%Y%m%d-%H%M%S", > localtime_r(&tv.tv_sec, &tm)); > (void) snprintf(buf, bufsize, "qemu_%s_%s_%d.core", > base_filename, timestamp, (int)getpid()); > - free(base_filename); > - free(filename); > + g_free(base_filename); > =20 > return (0); > } >=20 This patch fell through the cracks, I think. Paolo