]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
INET: Fix a potential memory leak
authorRoy Marples <roy@marples.name>
Wed, 23 Oct 2019 10:21:38 +0000 (11:21 +0100)
committerRoy Marples <roy@marples.name>
Wed, 23 Oct 2019 10:21:38 +0000 (11:21 +0100)
When someone deletes the address from under us.

src/dhcp.c
src/ipv4.c

index fb3462993a7bcb35adb9b3b7f566054680fd9bb2..65c81f6d086231b53d4976a6f2b1a33c808c5561 100644 (file)
@@ -4008,7 +4008,7 @@ dhcp_handleifa(int cmd, struct ipv4_addr *ia, pid_t pid)
                         * to drop the lease. */
                        dhcp_drop(ifp, "EXPIRE");
                        dhcp_start1(ifp);
-                       return NULL;
+                       return ia;
                }
        }
 
index f16b2a1f7dfd972a62027d805873248262d5718b..fd2a15d7019510f8fa50b43c86b55ea40e26a17b 100644 (file)
@@ -942,7 +942,7 @@ ipv4_handleifa(struct dhcpcd_ctx *ctx,
 #endif
        }
 
-       if (cmd == RTM_DELADDR && ia != NULL)
+       if (cmd == RTM_DELADDR)
                free(ia);
 }