Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1451015 > unrolled thread
| Started by | Alison Schofield <amsfield22@gmail.com> |
|---|---|
| First post | 2016-07-27 05:20 +0200 |
| Last post | 2016-07-27 10:20 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] tools: iio: iio_generic_buffer: initialize channel array pointer Alison Schofield <amsfield22@gmail.com> - 2016-07-27 05:20 +0200
Re: [PATCH] tools: iio: iio_generic_buffer: initialize channel array pointer Gregor Boirie <gregor.boirie@parrot.com> - 2016-07-27 10:20 +0200
| From | Alison Schofield <amsfield22@gmail.com> |
|---|---|
| Date | 2016-07-27 05:20 +0200 |
| Subject | [PATCH] tools: iio: iio_generic_buffer: initialize channel array pointer |
| Message-ID | <rZny1-2o5-1@gated-at.bofh.it> |
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(); -- 2.1.4
[toc] | [next] | [standalone]
| From | Gregor Boirie <gregor.boirie@parrot.com> |
|---|---|
| Date | 2016-07-27 10:20 +0200 |
| Message-ID | <rZsel-5j9-5@gated-at.bofh.it> |
| In reply to | #1451015 |
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.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web