diff --git a/src/network/networkd-neighbor.c b/src/network/networkd-neighbor.c index 908fc1c11c2..c14c8f7e06f 100644 --- a/src/network/networkd-neighbor.c +++ b/src/network/networkd-neighbor.c @@ -9,9 +9,9 @@ #include "networkd-network.h" #include "set.h" -void neighbor_free(Neighbor *neighbor) { +Neighbor *neighbor_free(Neighbor *neighbor) { if (!neighbor) - return; + return NULL; if (neighbor->network) { assert(neighbor->section); @@ -25,7 +25,7 @@ void neighbor_free(Neighbor *neighbor) { set_remove(neighbor->link->neighbors_foreign, neighbor); } - free(neighbor); + return mfree(neighbor); } DEFINE_NETWORK_SECTION_FUNCTIONS(Neighbor, neighbor_free); diff --git a/src/network/networkd-neighbor.h b/src/network/networkd-neighbor.h index 0c3dfc83031..f40fdccc481 100644 --- a/src/network/networkd-neighbor.h +++ b/src/network/networkd-neighbor.h @@ -30,7 +30,7 @@ typedef struct Neighbor { size_t lladdr_size; } Neighbor; -void neighbor_free(Neighbor *neighbor); +Neighbor *neighbor_free(Neighbor *neighbor); void network_verify_neighbors(Network *network);