Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182466
b: refs/heads/master
c: faa5c5c
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and Ingo Molnar committed Feb 21, 2010
1 parent 700b4ed commit 7fa5673
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 10fe12ef631a7e85022ed26304a37f033a6a95b8
refs/heads/master: faa5c5c36ec50bf43e39c7798ce9701e6b002db3
18 changes: 12 additions & 6 deletions trunk/tools/perf/util/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ int thread__set_comm(struct thread *self, const char *comm)
if (self->comm)
free(self->comm);
self->comm = strdup(comm);
return self->comm ? 0 : -ENOMEM;
if (self->comm == NULL)
return -ENOMEM;
self->comm_set = true;
return 0;
}

int thread__comm_len(struct thread *self)
Expand Down Expand Up @@ -255,11 +258,14 @@ int thread__fork(struct thread *self, struct thread *parent)
{
int i;

if (self->comm)
free(self->comm);
self->comm = strdup(parent->comm);
if (!self->comm)
return -ENOMEM;
if (parent->comm_set) {
if (self->comm)
free(self->comm);
self->comm = strdup(parent->comm);
if (!self->comm)
return -ENOMEM;
self->comm_set = true;
}

for (i = 0; i < MAP__NR_TYPES; ++i)
if (map_groups__clone(&self->mg, &parent->mg, i) < 0)
Expand Down
1 change: 1 addition & 0 deletions trunk/tools/perf/util/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ struct thread {
struct map_groups mg;
pid_t pid;
char shortname[3];
bool comm_set;
char *comm;
int comm_len;
};
Expand Down

0 comments on commit 7fa5673

Please sign in to comment.