[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <BANLkTik52KDNf3ANFdWxO9ey-fhCSxC0jQ@mail.gmail.com>
Date: Tue, 7 Jun 2011 17:45:08 +0200
From: Stephane Eranian <eranian@...gle.com>
To: Ingo Molnar <mingo@...e.hu>
Cc: LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: Re: [PATCH] perf: fix missing event name init for default event
On Mon, Jun 6, 2011 at 7:32 PM, Ingo Molnar <mingo@...e.hu> wrote:
>
> * Stephane Eranian <eranian@...gle.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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists