fall through in error case to clear congestion
[project/odhcpd.git] / src / dhcpv4.c
index 04ef182..a657e13 100644 (file)
@@ -222,7 +222,6 @@ int setup_dhcpv4_interface(struct interface *iface, bool enable)
                        struct dhcpv4_assignment *a = list_first_entry(&iface->dhcpv4_assignments,
                                        struct dhcpv4_assignment, head);
                        list_del(&a->head);
-                       free(a->hostname);
                        free(a);
                }
 
@@ -637,7 +636,7 @@ static struct dhcpv4_assignment* dhcpv4_lease(struct interface *iface,
        } else if (msg == DHCPV4_MSG_RELEASE) {
                if (a && a->valid_until != LONG_MAX)
                        a->valid_until = 0;
-       } else if (msg == DHCPV4_MSG_DECLINE && a->valid_until != LONG_MAX) {
+       } else if (msg == DHCPV4_MSG_DECLINE && a && a->valid_until != LONG_MAX) {
                memset(a->hwaddr, 0, sizeof(a->hwaddr));
                a->valid_until = now + 3600; // Block address for 1h
        }