network: make route_free() return NULL

This commit is contained in:
Yu Watanabe 2020-10-02 09:31:29 +09:00
parent 4468f01b67
commit 169948e9d2
2 changed files with 4 additions and 4 deletions

View File

@ -128,9 +128,9 @@ static int route_new_static(Network *network, const char *filename, unsigned sec
return 0; return 0;
} }
void route_free(Route *route) { Route *route_free(Route *route) {
if (!route) if (!route)
return; return NULL;
if (route->network) { if (route->network) {
LIST_REMOVE(routes, route->network->static_routes, route); LIST_REMOVE(routes, route->network->static_routes, route);
@ -164,7 +164,7 @@ void route_free(Route *route) {
sd_event_source_unref(route->expire); sd_event_source_unref(route->expire);
free(route); return mfree(route);
} }
void route_hash_func(const Route *route, struct siphash *state) { void route_hash_func(const Route *route, struct siphash *state) {

View File

@ -67,7 +67,7 @@ int route_compare_func(const Route *a, const Route *b);
extern const struct hash_ops route_hash_ops; extern const struct hash_ops route_hash_ops;
int route_new(Route **ret); int route_new(Route **ret);
void route_free(Route *route); Route *route_free(Route *route);
int route_configure(Route *route, Link *link, link_netlink_message_handler_t callback, Route **ret); int route_configure(Route *route, Link *link, link_netlink_message_handler_t callback, Route **ret);
int route_remove(Route *route, Link *link, link_netlink_message_handler_t callback); int route_remove(Route *route, Link *link, link_netlink_message_handler_t callback);