]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix a small memory leak
authorRoy Marples <roy@marples.name>
Wed, 2 Oct 2013 08:11:05 +0000 (08:11 +0000)
committerRoy Marples <roy@marples.name>
Wed, 2 Oct 2013 08:11:05 +0000 (08:11 +0000)
dev.c

diff --git a/dev.c b/dev.c
index 685fac7634ea6ec3ab173ac95e2d35f9dcce93da..d9a65a72e708dfbe385c88f6d83f2aca86657f42 100644 (file)
--- a/dev.c
+++ b/dev.c
@@ -69,6 +69,7 @@ dev_stop(void)
        if (dev) {
                syslog(LOG_DEBUG, "dev: unloaded %s", dev->name);
                dev->stop();
+               free(dev);
                dev = NULL;
        }
        if (handle) {
@@ -91,7 +92,8 @@ dev_start2(const char *name)
                syslog(LOG_ERR, "dlopen: %s", dlerror());
                return -1;
        }
-       fptr = (void (*)(struct dev *, const struct dev_dhcpcd *))dlsym(h, "dev_init");
+       fptr = (void (*)(struct dev *, const struct dev_dhcpcd *))
+           dlsym(h, "dev_init");
        if (fptr == NULL) {
                syslog(LOG_ERR, "dlsym: %s", dlerror());
                dlclose(h);
@@ -140,6 +142,7 @@ dev_start1(const char *plugin)
                if (r != -1)
                        break;
        }
+       closedir(dp);
        return r;
 }