Messages in this thread | | | Date | Tue, 7 Jun 2011 17:45:08 +0200 | Subject | Re: [PATCH] perf: fix missing event name init for default event | From | Stephane Eranian <> |
| |
On Mon, Jun 6, 2011 at 7:32 PM, Ingo Molnar <mingo@elte.hu> wrote: > > * Stephane Eranian <eranian@google.com> wrote: > >> @@ -87,6 +87,13 @@ int perf_evlist__add_default(struct perf_evlist *evlist) >> if (evsel == NULL) >> return -ENOMEM; >> >> + /* use strdup() because free(evsel) assumes name is allocated */ >> + evsel->name = strdup("cycles"); >> + if (!evsel->name) { >> + free(evsel); >> + return -ENOMEM; >> + } >> + >> perf_evlist__add(evlist, evsel); >> return 0; >> } > > Hm, nice fix, but this function should really follow the standard > exception tear-down sequence pattern we use in the kernel: > Fine, I can respin that patch.
> if (evsel == NULL) > goto err; > > ... > > if (!evsel->name) > goto err_free; > > ... > > return 0; > > err_free: > free(evsel); > err: > return -ENOMEM; > > Thanks, > > Ingo > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |