summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libgpio/gpio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libgpio/gpio.c b/lib/libgpio/gpio.c
index d22b3cf..8eb6871 100644
--- a/lib/libgpio/gpio.c
+++ b/lib/libgpio/gpio.c
@@ -89,7 +89,7 @@ gpio_pin_list(gpio_handle_t handle, gpio_config_t **pcfgs)
errno = EINVAL;
return (-1);
}
- cfgs = calloc(maxpins, sizeof(*cfgs));
+ cfgs = calloc(maxpins + 1, sizeof(*cfgs));
if (cfgs == NULL)
return (-1);
for (i = 0; i <= maxpins; i++) {
OpenPOWER on IntegriCloud