]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
eloop: Fix a memory leak
authorRoy Marples <roy@marples.name>
Fri, 31 Oct 2025 07:27:33 +0000 (07:27 +0000)
committerRoy Marples <roy@marples.name>
Fri, 31 Oct 2025 07:27:33 +0000 (07:27 +0000)
src/eloop.c

index a65e1679cb546b002a1f3366fe9132483859d94a..a1a4c906c2c3bbf431f89acc6c01c230172fa4cd 100644 (file)
@@ -185,7 +185,7 @@ eloop_event_setup_fds(struct eloop *eloop)
 #endif
 
        nfds += eloop->nevents;
-       if (eloop->nfds < nfds) {
+       if (nfds > eloop->nfds) {
                pfd = eloop_realloca(eloop->fds, nfds, sizeof(*pfd));
                if (pfd == NULL)
                        return -1;
@@ -870,6 +870,7 @@ eloop_free(struct eloop *eloop)
        if (eloop->fd != -1)
                close(eloop->fd);
 #endif
+       free(eloop->fds);
        free(eloop);
 }