X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Fdhcpv4.c;h=a657e13d325f9e4de34a8ec0e5c904d44967274d;hp=462f641a0b6ab1b85ddf39ab4c0fabe222c3a831;hb=a3d1f5148222174f12ea8df0c20a554fc5eaabab;hpb=549a4a7d93a828d7d2b9354bc1b1957de4333e65;ds=sidebyside diff --git a/src/dhcpv4.c b/src/dhcpv4.c index 462f641..a657e13 100644 --- a/src/dhcpv4.c +++ b/src/dhcpv4.c @@ -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); } @@ -554,12 +553,12 @@ static bool dhcpv4_assign(struct interface *iface, return true; } - for (size_t i = 0; i < count; ++i) { + for (uint32_t i = 0; i < count; ++i) { if (dhcpv4_test(iface, try)) { /* test was successful: IP address is not assigned, assign it */ assign->addr = try; list_add(&assign->head, &iface->dhcpv4_assignments); - syslog(LOG_DEBUG, "assigning mapped IP: %u.%u.%u.%u (try %d of %d)", + syslog(LOG_DEBUG, "assigning mapped IP: %u.%u.%u.%u (try %u of %u)", (assign->addr & 0xff000000) >> 24, (assign->addr & 0x00ff0000) >> 16, (assign->addr & 0x0000ff00) >> 8, @@ -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 }