Skip to content

odhcpd: Ignore NULL in dhcpv4_free_lease() stub#384

Merged
openwrt-bot merged 1 commit intoopenwrt:masterfrom
mmmspatz:mspatz/dhcpv4_free_lease_stub_guard
Mar 16, 2026
Merged

odhcpd: Ignore NULL in dhcpv4_free_lease() stub#384
openwrt-bot merged 1 commit intoopenwrt:masterfrom
mmmspatz:mspatz/dhcpv4_free_lease_stub_guard

Conversation

@mmmspatz
Copy link
Copy Markdown
Contributor

@mmmspatz mmmspatz commented Mar 1, 2026

When DHCPV4_SUPPORT is not defined, a stub implementation of dhcpv4_free_lease() is provided that logs an error when it's called. A couple sites in config.c unconditionally free the dhcpv4_lease field of struct lease_cfg, causing log spam like:

Trying to free IPv4 assignment 0x(nil)

Silence by making the stub a noop if the argument is NULL, just like the actual implementation.

Fixes: #382

@mmmspatz mmmspatz force-pushed the mspatz/dhcpv4_free_lease_stub_guard branch from 6d30361 to 7b76745 Compare March 1, 2026 00:52
@mmmspatz
Copy link
Copy Markdown
Contributor Author

mmmspatz commented Mar 1, 2026

Oops, originally referenced the wrong issue.

@mmmspatz mmmspatz force-pushed the mspatz/dhcpv4_free_lease_stub_guard branch from 7b76745 to ea3d9f6 Compare March 2, 2026 16:12
When DHCPV4_SUPPORT is not defined, a stub implementation of
dhcpv4_free_lease() is provided that logs an error when it's called. A
couple sites in config.c unconditionally free the dhcpv4_lease field of
struct lease_cfg, causing log spam like:
| Trying to free IPv4 assignment 0x(nil)

Silence by making the stub a noop if the argument is NULL, just like the
actual implementation.

Closes: openwrt#382
Signed-off-by: Mark H. Spatz <mark.h.spatz@gmail.com>
Link: openwrt#384
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
@Noltari Noltari force-pushed the mspatz/dhcpv4_free_lease_stub_guard branch from ea3d9f6 to 2a316db Compare March 16, 2026 17:47
@openwrt-bot openwrt-bot merged commit 2a316db into openwrt:master Mar 16, 2026
9 checks passed
@Noltari
Copy link
Copy Markdown
Member

Noltari commented Mar 16, 2026

Merged, thanks @mmmspatz!

Noltari pushed a commit to Noltari/odhcpd that referenced this pull request Mar 16, 2026
When DHCPV4_SUPPORT is not defined, a stub implementation of
dhcpv4_free_lease() is provided that logs an error when it's called. A
couple sites in config.c unconditionally free the dhcpv4_lease field of
struct lease_cfg, causing log spam like:
| Trying to free IPv4 assignment 0x(nil)

Silence by making the stub a noop if the argument is NULL, just like the
actual implementation.

(cherry picked from commit 2a316db)
Closes: openwrt#382
Signed-off-by: Mark H. Spatz <mark.h.spatz@gmail.com>
Link: openwrt#384
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trying to free IPv4 assignment 0x(nil)

3 participants