network: fix memleak

Fixes a bug introduced by af2aea8bb6.

Fixes #25883 and #25891.
This commit is contained in:
Yu Watanabe
2023-01-16 19:42:59 +00:00
committed by Luca Boccassi
parent 37df1221d5
commit 303dfa73b3
2 changed files with 10 additions and 2 deletions
+5 -1
View File
@@ -1216,9 +1216,13 @@ int link_request_address(
(void) address_get(link, address, &existing);
if (address->lifetime_valid_usec == 0)
if (address->lifetime_valid_usec == 0) {
if (consume_object)
address_free(address);
/* The requested address is outdated. Let's remove it. */
return address_remove_and_drop(existing);
}
if (!existing) {
_cleanup_(address_freep) Address *tmp = NULL;
+5 -1
View File
@@ -1437,9 +1437,13 @@ int link_request_route(
(void) route_get(link->manager, link, route, &existing);
if (route->lifetime_usec == 0)
if (route->lifetime_usec == 0) {
if (consume_object)
route_free(route);
/* The requested route is outdated. Let's remove it. */
return route_remove_and_drop(existing);
}
if (!existing) {
_cleanup_(route_freep) Route *tmp = NULL;