linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Crestez Dan Leonard <leonard.crestez@intel.com>
To: Jonathan Cameron <jic23@kernel.org>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Daniel Baluta <daniel.baluta@intel.com>
Subject: Re: [PATCH 1/2] iio: generic_buffer: Cleanup when receiving signals
Date: Mon, 23 May 2016 19:10:52 +0300	[thread overview]
Message-ID: <9de98860-1670-dbc2-b419-8e623deda6ea@intel.com> (raw)
In-Reply-To: <c7be250e-cc01-98ba-c211-36bbd154366e@kernel.org>

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

  reply	other threads:[~2016-05-23 16:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-20 15:45 [PATCH 1/2] iio: generic_buffer: Cleanup when receiving signals Crestez Dan Leonard
2016-05-20 15:45 ` [PATCH 2/2] iio: generic_buffer: Add --device-num option Crestez Dan Leonard
2016-05-21 16:30   ` Jonathan Cameron
2016-05-20 15:55 ` [PATCH 1/2] iio: generic_buffer: Cleanup when receiving signals Peter Meerwald-Stadler
2016-05-21 16:28   ` Jonathan Cameron
2016-05-23 16:10     ` Crestez Dan Leonard [this message]
2016-05-29 19:11       ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9de98860-1670-dbc2-b419-8e623deda6ea@intel.com \
    --to=leonard.crestez@intel.com \
    --cc=daniel.baluta@intel.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).