Sorry, it can't work with

name = NULL; 

Same problem like before.


wkq




At 2010-12-31 17:31:43,"Sergey Senozhatsky" <[email protected]> 
wrote:

>On (12/31/10 09:21), wkq5325 wrote:
>>    Thanks. I try gdb.
>>    find the problem is
>>    .........
>>    #6  0x0805d289 in perf_event::set_event_name (this=0xc94ff4,
>>    event_name=0x8089a6b "power:power_frequency")
>>        at perf/perf.cpp:152
>>    ..............
>>    I find  void perf_event::set_event_name(const char *event_name)
>>    150 {
>>    151     if (name)
>>    152         free(name);
>>    153
>>    154     name = strdup(event_name);
>>    155     char *c;
>>    I think if(name) is the problem, so I change it with if(!name).
>>    It can work now.
>>    Is it a bug??
>> 
>
>No, changing it to `if (!name)' will introduce bug.
>Could you please try the following one:
>
>---
>
> perf/perf.cpp |    1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
>diff --git a/perf/perf.cpp b/perf/perf.cpp
>index c9758ff..2f2686b 100644
>--- a/perf/perf.cpp
>+++ b/perf/perf.cpp
>@@ -177,6 +177,7 @@ void perf_event::set_cpu(int _cpu)
> 
> perf_event::perf_event(const char *event_name, int _cpu, int buffer_size)
> {
>+      name = NULL;
>       set_event_name(event_name);
>       perf_fd = -1;
>       bufsize = buffer_size;
>
_______________________________________________
Discuss mailing list
[email protected]
http://lists.lesswatts.org/listinfo/discuss

Reply via email to