diff options
Diffstat (limited to 'tools/perf/util/probe-finder.c')
-rw-r--r-- | tools/perf/util/probe-finder.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index c171a243d05b..e887bb6157cd 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
@@ -125,8 +125,7 @@ static void line_list__add_line(struct list_head *head, unsigned int line) | |||
125 | p = head; | 125 | p = head; |
126 | found: | 126 | found: |
127 | pr_debug("line list: add a line %u\n", line); | 127 | pr_debug("line list: add a line %u\n", line); |
128 | ln = zalloc(sizeof(struct line_node)); | 128 | ln = xzalloc(sizeof(struct line_node)); |
129 | DIE_IF(ln == NULL); | ||
130 | ln->line = line; | 129 | ln->line = line; |
131 | INIT_LIST_HEAD(&ln->list); | 130 | INIT_LIST_HEAD(&ln->list); |
132 | list_add(&ln->list, p); | 131 | list_add(&ln->list, p); |
@@ -416,7 +415,7 @@ static void show_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf) | |||
416 | (unsigned long)(pf->addr - eaddr)); | 415 | (unsigned long)(pf->addr - eaddr)); |
417 | /* Copy the function name if possible */ | 416 | /* Copy the function name if possible */ |
418 | if (!pp->function) { | 417 | if (!pp->function) { |
419 | pp->function = strdup(name); | 418 | pp->function = xstrdup(name); |
420 | pp->offset = (size_t)(pf->addr - eaddr); | 419 | pp->offset = (size_t)(pf->addr - eaddr); |
421 | } | 420 | } |
422 | } else { | 421 | } else { |
@@ -425,7 +424,7 @@ static void show_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf) | |||
425 | (uintmax_t)pf->addr); | 424 | (uintmax_t)pf->addr); |
426 | if (!pp->function) { | 425 | if (!pp->function) { |
427 | /* TODO: Use _stext */ | 426 | /* TODO: Use _stext */ |
428 | pp->function = strdup(""); | 427 | pp->function = xstrdup(""); |
429 | pp->offset = (size_t)pf->addr; | 428 | pp->offset = (size_t)pf->addr; |
430 | } | 429 | } |
431 | } | 430 | } |
@@ -456,7 +455,7 @@ static void show_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf) | |||
456 | if (pp->found == MAX_PROBES) | 455 | if (pp->found == MAX_PROBES) |
457 | die("Too many( > %d) probe point found.\n", MAX_PROBES); | 456 | die("Too many( > %d) probe point found.\n", MAX_PROBES); |
458 | 457 | ||
459 | pp->probes[pp->found] = strdup(tmp); | 458 | pp->probes[pp->found] = xstrdup(tmp); |
460 | pp->found++; | 459 | pp->found++; |
461 | } | 460 | } |
462 | 461 | ||
@@ -506,8 +505,7 @@ static int find_lazy_match_lines(struct list_head *head, | |||
506 | if (fd < 0) | 505 | if (fd < 0) |
507 | die("failed to open %s", fname); | 506 | die("failed to open %s", fname); |
508 | DIE_IF(fstat(fd, &st) < 0); | 507 | DIE_IF(fstat(fd, &st) < 0); |
509 | fbuf = malloc(st.st_size + 2); | 508 | fbuf = xmalloc(st.st_size + 2); |
510 | DIE_IF(fbuf == NULL); | ||
511 | DIE_IF(read(fd, fbuf, st.st_size) < 0); | 509 | DIE_IF(read(fd, fbuf, st.st_size) < 0); |
512 | close(fd); | 510 | close(fd); |
513 | fbuf[st.st_size] = '\n'; /* Dummy line */ | 511 | fbuf[st.st_size] = '\n'; /* Dummy line */ |
@@ -727,7 +725,7 @@ static void find_line_range_by_line(Dwarf_Die *sp_die, struct line_finder *lf) | |||
727 | 725 | ||
728 | /* Copy real path */ | 726 | /* Copy real path */ |
729 | if (!lf->lr->path) | 727 | if (!lf->lr->path) |
730 | lf->lr->path = strdup(src); | 728 | lf->lr->path = xstrdup(src); |
731 | line_list__add_line(&lf->lr->line_list, (unsigned int)lineno); | 729 | line_list__add_line(&lf->lr->line_list, (unsigned int)lineno); |
732 | } | 730 | } |
733 | /* Update status */ | 731 | /* Update status */ |