From: Mark Drayton Date: Tue, 21 Jun 2016 12:37:27 +0000 (+0100) Subject: Fix nits for /tmp/perf-pid.map support X-Git-Tag: v0.2.0~67^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db724e2cc007c1f3aa155b61902bf1e2c3c4ab34;p=platform%2Fupstream%2Fbcc.git Fix nits for /tmp/perf-pid.map support --- diff --git a/src/cc/bcc_perf_map.c b/src/cc/bcc_perf_map.c index 6a74a97..b6173a0 100644 --- a/src/cc/bcc_perf_map.c +++ b/src/cc/bcc_perf_map.c @@ -33,12 +33,13 @@ int bcc_perf_map_nspid(int pid) { // return the original PID if the NSpid line is missing int nspid = pid; - size_t size; + size_t size = 0; char *line = NULL; - while (getline(&line, &size, status) != -1) + while (getline(&line, &size, status) != -1) { if (strstr(line, "NSpid:") != NULL) // PID namespaces can be nested -- last number is innermost PID nspid = (int)strtol(strrchr(line, '\t'), NULL, 10); + } free(line); return nspid; @@ -70,7 +71,7 @@ int bcc_perf_map_foreach_sym(const char *path, bcc_perf_map_symcb callback, return -1; char *line = NULL; - size_t size; + size_t size = 0; long long begin, len; while (getline(&line, &size, file) != -1) { char *cursor = line;