Skip to content

Commit

Permalink
Fix leak of pwm enable file descriptor (#197)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
pdp7 committed Nov 24, 2017
1 parent 721b063 commit 503e839
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/c_pwm.c
Expand Up @@ -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
Expand Down

0 comments on commit 503e839

Please sign in to comment.