Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1405494

Re: [PATCH 1/2] iio: generic_buffer: Cleanup when receiving signals

From Crestez Dan Leonard <leonard.crestez@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] iio: generic_buffer: Cleanup when receiving signals
Date 2016-05-23 18:20 +0200
Message-ID <rC0Ke-89d-15@gated-at.bofh.it> (permalink)
References <rAUQy-7ji-15@gated-at.bofh.it> <rAV0d-7mk-5@gated-at.bofh.it> <rBhWO-5Op-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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?

I submitted v2 which keeps the frees. It still simplifies them by
relying on stuff like free(NULL) being allowed.

-- 
Regards,
Leonard

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] iio: generic_buffer: Cleanup when receiving signals Crestez Dan Leonard <leonard.crestez@intel.com> - 2016-05-20 17:50 +0200
  [PATCH 2/2] iio: generic_buffer: Add --device-num option Crestez Dan Leonard <leonard.crestez@intel.com> - 2016-05-20 17:50 +0200
    Re: [PATCH 2/2] iio: generic_buffer: Add --device-num option Jonathan Cameron <jic23@kernel.org> - 2016-05-21 18:40 +0200
  Re: [PATCH 1/2] iio: generic_buffer: Cleanup when receiving  signals Peter Meerwald-Stadler <pmeerw@pmeerw.net> - 2016-05-20 18:00 +0200
    Re: [PATCH 1/2] iio: generic_buffer: Cleanup when receiving signals Jonathan Cameron <jic23@kernel.org> - 2016-05-21 18:30 +0200
      Re: [PATCH 1/2] iio: generic_buffer: Cleanup when receiving signals Crestez Dan Leonard <leonard.crestez@intel.com> - 2016-05-23 18:20 +0200
        Re: [PATCH 1/2] iio: generic_buffer: Cleanup when receiving signals Jonathan Cameron <jic23@kernel.org> - 2016-05-29 21:20 +0200

csiph-web