mirror of https://github.com/proxmox/mirror_qemu
linux-user: complete omission of removing uses of strdup
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>
Message-Id: <1459997185-15669-2-git-send-email-weijg.fnst@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
master
parent
7616f1c2da
commit
b8da57fa15
|
@ -2718,7 +2718,6 @@ static int core_dump_filename(const TaskState *ts, char *buf,
|
||||||
size_t bufsize)
|
size_t bufsize)
|
||||||
{
|
{
|
||||||
char timestamp[64];
|
char timestamp[64];
|
||||||
char *filename = NULL;
|
|
||||||
char *base_filename = NULL;
|
char *base_filename = NULL;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
|
@ -2731,14 +2730,12 @@ static int core_dump_filename(const TaskState *ts, char *buf,
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = strdup(ts->bprm->filename);
|
base_filename = g_path_get_basename(ts->bprm->filename);
|
||||||
base_filename = strdup(basename(filename));
|
|
||||||
(void) strftime(timestamp, sizeof (timestamp), "%Y%m%d-%H%M%S",
|
(void) strftime(timestamp, sizeof (timestamp), "%Y%m%d-%H%M%S",
|
||||||
localtime_r(&tv.tv_sec, &tm));
|
localtime_r(&tv.tv_sec, &tm));
|
||||||
(void) snprintf(buf, bufsize, "qemu_%s_%s_%d.core",
|
(void) snprintf(buf, bufsize, "qemu_%s_%s_%d.core",
|
||||||
base_filename, timestamp, (int)getpid());
|
base_filename, timestamp, (int)getpid());
|
||||||
free(base_filename);
|
g_free(base_filename);
|
||||||
free(filename);
|
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue