Page MenuHomeFreeBSD

D6465.id16585.diff
No OneTemporary

D6465.id16585.diff

Index: usr.sbin/pmcstat/pmcpl_gprof.c
===================================================================
--- usr.sbin/pmcstat/pmcpl_gprof.c
+++ usr.sbin/pmcstat/pmcpl_gprof.c
@@ -310,8 +310,9 @@
void
pmcpl_gmon_initimage(struct pmcstat_image *pi)
{
+ const char *execpath;
int count, nlen;
- char *sn;
+ char *sn, *snbuf;
char name[NAME_MAX];
/*
@@ -321,9 +322,11 @@
* `basename(path)`+ "~" + NNN + ".gmon" till we get a free
* entry.
*/
- if ((sn = basename(pmcstat_string_unintern(pi->pi_execpath))) == NULL)
- err(EX_OSERR, "ERROR: Cannot process \"%s\"",
- pmcstat_string_unintern(pi->pi_execpath));
+ execpath = pmcstat_string_unintern(pi->pi_execpath);
+ if ((snbuf = strdup(execpath)) == NULL)
+ err(EX_OSERR, "ERROR: Cannot copy \"%s\"", execpath);
+ if ((sn = basename(snbuf)) == NULL)
+ err(EX_OSERR, "ERROR: Cannot process \"%s\"", execpath);
nlen = strlen(sn);
nlen = min(nlen, (int) (sizeof(name) - sizeof(".gmon")));
@@ -355,6 +358,7 @@
}
} while (count > 0);
}
+ free(snbuf);
LIST_INIT(&pi->pi_gmlist);
}

File Metadata

Mime Type
text/plain
Expires
Tue, Aug 25, 9:38 AM (6 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37231234
Default Alt Text
D6465.id16585.diff (1 KB)

Event Timeline