Skip to content

Commit 503e839

Browse files
committed
Fix leak of pwm enable file descriptor (adafruit#197)
Make sure that the file descriptor for pwm enable is closed along with the other pwm file descriptors Signed-off-by: Drew Fustini <drew@pdp7.com>
1 parent 721b063 commit 503e839

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

source/c_pwm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,9 @@ BBIO_err pwm_setup(const char *key, __attribute__ ((unused)) float duty, __attri
553553
close(period_fd);
554554
close(duty_fd);
555555
close(polarity_fd);
556+
#ifdef BBBVERSION41
557+
close(enable_fd);
558+
#endif
556559
syslog(LOG_ERR, "Adafruit_BBIO: pwm_setup: %s couldn't malloc pwm_exp: %i-%s",
557560
key, errno, strerror(errno));
558561
return BBIO_MEM; // out of memory

0 commit comments

Comments
 (0)