Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 74cf249d authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf tools: Use zfree to help detect use after free bugs

Several areas already used this technique, so do some audit to
consistently use it elsewhere.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-9sbere0kkplwe45ak6rk4a1f@git.kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 04662523
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -654,7 +654,7 @@ static void data__free(struct data__file *d)
	for (col = 0; col < PERF_HPP_DIFF__MAX_INDEX; col++) {
		struct diff_hpp_fmt *fmt = &d->fmt[col];

		free(fmt->header);
		zfree(&fmt->header);
	}
}

+1 −1
Original line number Diff line number Diff line
@@ -469,7 +469,7 @@ static void *thread_func(void *ctx)
	char comm2[22];
	int fd;

	free(parms);
	zfree(&parms);

	sprintf(comm2, ":%s", this_task->comm);
	prctl(PR_SET_NAME, comm2);
+3 −3
Original line number Diff line number Diff line
@@ -1102,9 +1102,9 @@ static struct script_desc *script_desc__new(const char *name)

static void script_desc__delete(struct script_desc *s)
{
	free(s->name);
	free(s->half_liner);
	free(s->args);
	zfree(&s->name);
	zfree(&s->half_liner);
	zfree(&s->args);
	free(s);
}

+1 −1
Original line number Diff line number Diff line
@@ -1327,7 +1327,7 @@ static int switch_data_file(void)

			abs_path[nr_options] = strdup(path);
			if (!abs_path[nr_options]) {
				free(options[nr_options]);
				zfree(&options[nr_options]);
				ui__warning("Can't search all data files due to memory shortage.\n");
				fclose(file);
				break;
+1 −1
Original line number Diff line number Diff line
@@ -510,7 +510,7 @@ print_entries:

	free(line);
out:
	free(rem_sq_bracket);
	zfree(&rem_sq_bracket);

	return ret;
}
Loading