From: Paolo Bonzini <pbonzini@redhat.com>
To: Wei Jiangang <weijg.fnst@cn.fujitsu.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, Riku Voipio <riku.voipio@iki.fi>
Subject: Re: [Qemu-devel] [PATCH 1/3] linux-user: complete omission of removing uses of strdup
Date: Thu, 14 Jul 2016 14:13:05 +0200 [thread overview]
Message-ID: <38e9c5ee-89e7-295b-9983-3b19db14e740@redhat.com> (raw)
In-Reply-To: <1459997185-15669-2-git-send-email-weijg.fnst@cn.fujitsu.com>
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.
>
> Signed-off-by: Wei Jiangang <weijg.fnst@cn.fujitsu.com>
> ---
> linux-user/elfload.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> 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 = NULL;
> char *base_filename = NULL;
> struct timeval tv;
> struct tm tm;
> @@ -2731,14 +2730,12 @@ static int core_dump_filename(const TaskState *ts, char *buf,
> return (-1);
> }
>
> - filename = strdup(ts->bprm->filename);
> - base_filename = strdup(basename(filename));
> + base_filename = 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);
>
> return (0);
> }
>
This patch fell through the cracks, I think.
Paolo
next prev parent reply other threads:[~2016-07-14 12:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-07 2:46 [Qemu-devel] [PATCH 0/3] bitsized task for glib conversion Wei Jiangang
2016-04-07 2:46 ` [Qemu-devel] [PATCH 1/3] linux-user: complete omission of removing uses of strdup Wei Jiangang
2016-07-14 12:13 ` Paolo Bonzini [this message]
2016-04-07 2:46 ` [Qemu-devel] [PATCH 2/3] use g_path_get_dirname instead of dirname Wei Jiangang
2016-04-07 2:46 ` [Qemu-devel] [PATCH 3/3] use g_path_get_basename instead of basename Wei Jiangang
2016-04-12 11:05 ` [Qemu-devel] [PATCH 0/3] bitsized task for glib conversion Wei, Jiangang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=38e9c5ee-89e7-295b-9983-3b19db14e740@redhat.com \
--to=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
--cc=weijg.fnst@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).