nokia-gpio: Fix memory leak

All dir opened with opendir must be closed with closedir
This commit is contained in:
Bertrand Aygon 2011-05-11 17:27:43 +02:00 committed by Denis Kenzior
parent 62370c5491
commit 74d3550788
1 changed files with 5 additions and 1 deletions

View File

@ -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);
}