[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] top: fix double free causing a SIGABRT storm after SIGPIPE
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2016-08-20 15:15:56
Message-ID: CAK1hOcN5b3FsJqm3eseYXRoZu4u6oo2rz8uxVk+_hs8dSNO-kw () mail ! gmail ! com
[Download RAW message or body]

On Fri, Aug 19, 2016 at 10:21 PM, Rob Landley <rob@landley.net> wrote:
> On 08/19/2016 01:30 PM, Denys Vlasenko wrote:
>> On Fri, Aug 19, 2016 at 8:17 PM, Rob Landley <rob@landley.net> wrote:
>>> On 08/19/2016 04:10 AM, Denys Vlasenko wrote:
>>>> +       if (ENABLE_FEATURE_CLEAN_UP) {
>>>> +               clearmems();
>>>> +#if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
>>>> +               free(prev_hist);
>>>> +#endif
>>>> +       }
>>>
>>> The point of the ENABLE macros was so that you can go:
>>>
>>>   if (ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE)
>>>     free(prev_hist);
>>>
>>> Instead of the #ifdef forest. #ifdef CONFIG_FEATURE_BLAH already existed...
>>
>> Indeed ifders are ugly.
>> In this case, prev_hist does not exist if
>> !ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE:
>>
>> rocps/top.c:195:28: error: ‘struct globals' has no member named ‘prev_hist'
>>  #define prev_hist        (G.prev_hist         )
>>                             ^
>> procps/top.c:1258:9: note: in expansion of macro ‘prev_hist'
>>     free(prev_hist);
>>          ^~~~~~~~~
>
> You're right, this entire file is an #ifdef forest.


It was worse :)
Sometime ago I selected a few opts which had minimal effect on code size
and nuked those.
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic