lkml.org 
[lkml]   [2016]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/2] iio: generic_buffer: Cleanup when receiving signals
From
Date
On 23/05/16 17:10, Crestez Dan Leonard wrote:
> On 05/21/2016 07:28 PM, Jonathan Cameron wrote:
>> On 20/05/16 16:55, Peter Meerwald-Stadler wrote:
>>>
>>>> This also drops all the code freeing string buffers at the end of main.
>>>> Memory is freed when the process exits anyway so there's no point in
>>>> cluttering the code with all those gotos.
>>>
>>> well, it helps to see that all memory has been released when looking for
>>> leaks :)
>>> e.g. valgrind becomes much less useful when the program exits with tons of
>>> memory still allocated
>> Beyond that we are looking at code here that will get cut and paste into other
>> peoples applications - they might not pick up that it doesn't clean up properly
>> after itself.
>>
>> I'd much prefer to keep these explicit frees in place.
>
> I think this would make more sense for a library (like libiio). But
> isn't the code in tools/iio merely an a test tool?
Absolutely - but as we all know test tool code gets copied when one is an hurry!
>
> I submitted v2 which keeps the frees. It still simplifies them by
> relying on stuff like free(NULL) being allowed.
That's a nicer approach.

Jonathan
>

\
 
 \ /
  Last update: 2016-05-29 21:21    [W:0.062 / U:1.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site