From 503e8397e64e20befdf5231485c693be39d263fc Mon Sep 17 00:00:00 2001 From: Drew Fustini Date: Fri, 24 Nov 2017 00:29:04 -0600 Subject: [PATCH] Fix leak of pwm enable file descriptor (#197) Make sure that the file descriptor for pwm enable is closed along with the other pwm file descriptors Signed-off-by: Drew Fustini --- source/c_pwm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/c_pwm.c b/source/c_pwm.c index ccf4a0c..e6bc7b0 100644 --- a/source/c_pwm.c +++ b/source/c_pwm.c @@ -553,6 +553,9 @@ BBIO_err pwm_setup(const char *key, __attribute__ ((unused)) float duty, __attri close(period_fd); close(duty_fd); close(polarity_fd); +#ifdef BBBVERSION41 + close(enable_fd); +#endif syslog(LOG_ERR, "Adafruit_BBIO: pwm_setup: %s couldn't malloc pwm_exp: %i-%s", key, errno, strerror(errno)); return BBIO_MEM; // out of memory