From: Marc Schink Date: Wed, 20 Aug 2014 11:54:53 +0000 (+0200) Subject: output: Allocate additional memory for NULL terminator. X-Git-Tag: libsigrok-0.4.0~1135 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=879dd50fb6d5f810d3c5635c3264b2c08ad22a70;p=libsigrok.git output: Allocate additional memory for NULL terminator. Best regards, Marc >From a7228150fdea91a65b5d70359bf51b87d2572edf Mon Sep 17 00:00:00 2001 From: Marc Schink Date: Wed, 20 Aug 2014 05:34:57 -0400 Subject: [PATCH] output: Allocate additional memory for NULL terminator. --- diff --git a/src/output/output.c b/src/output/output.c index b3dfad19..9a6d6679 100644 --- a/src/output/output.c +++ b/src/output/output.c @@ -172,7 +172,7 @@ SR_API const struct sr_option **sr_output_options_get(const struct sr_output_mod for (size = 1; mod_opts[size].id; size++) ; - opts = g_malloc(size * sizeof(struct sr_option *)); + opts = g_malloc((size + 1) * sizeof(struct sr_option *)); for (i = 0; i < size; i++) opts[i] = &mod_opts[i];