network: fix memleak
Fixes a bug introduced by af2aea8bb6.
Fixes #25883 and #25891.
This commit is contained in:
committed by
Luca Boccassi
parent
37df1221d5
commit
303dfa73b3
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user