From 87fda627596850347cf820f30832c784d4d0089b Mon Sep 17 00:00:00 2001 From: Noel Eck Date: Mon, 17 Apr 2017 11:55:02 -0700 Subject: [PATCH] peripheralman.c: Allocate pwm context for spi Updated the mraa_pman_pwm_init_replace method to allocate heap space for the mraa_pwm_context (returned by this method. Signed-off-by: Noel Eck --- src/peripheralman/peripheralman.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/peripheralman/peripheralman.c b/src/peripheralman/peripheralman.c index 1b2ece3..2017dbc 100644 --- a/src/peripheralman/peripheralman.c +++ b/src/peripheralman/peripheralman.c @@ -44,7 +44,7 @@ int pwm_dev_count = 0; static mraa_pwm_context mraa_pman_pwm_init_replace(int pin) { - mraa_pwm_context dev; + mraa_pwm_context dev = (mraa_pwm_context) calloc(1, sizeof(struct _pwm)); if (APeripheralManagerClient_openPwm(client, pwm_devices[pin], &dev->bpwm) != 0) { APwm_delete(dev->bpwm); return NULL;