diff options
author | Bertrand Aygon <bertrand.aygon@intel.com> | 2011-05-11 17:27:43 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-05-11 13:29:33 -0500 |
commit | 74d355078879353d88668cce4f957db434fbdac5 (patch) | |
tree | 469a0775568fac61af4e21f4dbcad45d2c5b2df2 | |
parent | 62370c5491af2b385a72044df5a765fe866dbee7 (diff) | |
download | ofono-74d355078879353d88668cce4f957db434fbdac5.tar.bz2 |
nokia-gpio: Fix memory leak
All dir opened with opendir must be closed with closedir
-rw-r--r-- | plugins/nokia-gpio.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/nokia-gpio.c b/plugins/nokia-gpio.c index b025f3eb..57aad8d0 100644 --- a/plugins/nokia-gpio.c +++ b/plugins/nokia-gpio.c @@ -662,8 +662,10 @@ static int gpio_probe_links(void) FILE *nf; size_t len; - if (d == NULL) + if (d == NULL) { + (void) closedir(gpio); return 0; + } snprintf(nn, sizeof nn, "%s/%s/name", gpiodir, d->d_name); @@ -700,6 +702,8 @@ static int gpio_probe_links(void) DBG("%s: %s", "/sys/class/gpio", strerror(errno)); + (void) closedir(gpio); + return -(errno = ENODEV); } |