From: Gregor Boirie <gregor.boirie@parrot.com>
To: Alison Schofield <amsfield22@gmail.com>, <jic23@kernel.org>
Cc: <knaack.h@gmx.de>, <lars@metafoo.de>, <pmeerw@pmeerw.net>,
<linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tools: iio: iio_generic_buffer: initialize channel array pointer
Date: Wed, 27 Jul 2016 10:12:35 +0200 [thread overview]
Message-ID: <57986CF3.4070602@parrot.com> (raw)
In-Reply-To: <20160727031734.GA31933@d830.WORKGROUP>
On 07/27/2016 05:17 AM, Alison Schofield wrote:
> Uninitialized channel pointer causes segmentation fault when we
> call free(channel) during cleanup() with no channels initialized.
> This happens when you exit early for usage errors. Initialize
> the pointer to NULL when it is declared.
>
> Signed-off-by: Alison Schofield <amsfield22@gmail.com>
> Cc: Daniel Baluta <daniel.baluta@gmail.com>
> ---
> tools/iio/iio_generic_buffer.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c
> index 0e8a1f7..ae68bf0 100644
> --- a/tools/iio/iio_generic_buffer.c
> +++ b/tools/iio/iio_generic_buffer.c
> @@ -348,7 +348,7 @@ int main(int argc, char **argv)
> int notrigger = 0;
> char *dummy;
>
> - struct iio_channel_info *channels;
> + struct iio_channel_info *channels = NULL;
>
> register_cleanup();
>
Tested-by: Gregor Boirie <gregor.boirie@parrot.com>
greg.
next prev parent reply other threads:[~2016-07-27 8:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-27 3:17 [PATCH] tools: iio: iio_generic_buffer: initialize channel array pointer Alison Schofield
2016-07-27 8:12 ` Gregor Boirie [this message]
2016-08-15 16:06 ` 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=57986CF3.4070602@parrot.com \
--to=gregor.boirie@parrot.com \
--cc=amsfield22@gmail.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