mirror of git://git.sysmocom.de/ofono
nokia-gpio: Fix memory leak
All dir opened with opendir must be closed with closedir
This commit is contained in:
parent
62370c5491
commit
74d3550788
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue