]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: disable event sources before unref them
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 24 Sep 2021 08:26:10 +0000 (17:26 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 24 Sep 2021 08:26:10 +0000 (17:26 +0900)
src/network/networkd-lldp-tx.c
src/network/networkd-route.c

index 66b3216bf4364a34a7eadc4cbc8898453471aeeb..c1cbe60d73bab484ee2634ac78cbfd3d99c48fa8 100644 (file)
@@ -410,7 +410,7 @@ int link_lldp_emit_start(Link *link) {
 void link_lldp_emit_stop(Link *link) {
         assert(link);
 
-        link->lldp_emit_event_source = sd_event_source_unref(link->lldp_emit_event_source);
+        link->lldp_emit_event_source = sd_event_source_disable_unref(link->lldp_emit_event_source);
 }
 
 static const char * const lldp_emit_table[_LLDP_EMIT_MAX] = {
index 1f613b6e0bd22561ec9a994333ee74576781f399..c94887ef8a1bfc3083a33711d16840c13e5f1f13 100644 (file)
@@ -269,7 +269,7 @@ Route *route_free(Route *route) {
 
         ordered_set_free_with_destructor(route->multipath_routes, multipath_route_free);
 
-        sd_event_source_unref(route->expire);
+        sd_event_source_disable_unref(route->expire);
 
         return mfree(route);
 }
@@ -1261,7 +1261,7 @@ static int route_expire_handler(sd_event_source *s, uint64_t usec, void *userdat
 }
 
 static int route_add_and_setup_timer_one(Link *link, const Route *route, const MultipathRoute *m, const NextHop *nh, uint8_t nh_weight, Route **ret) {
-        _cleanup_(sd_event_source_unrefp) sd_event_source *expire = NULL;
+        _cleanup_(sd_event_source_disable_unrefp) sd_event_source *expire = NULL;
         Route *nr;
         int r;
 
@@ -1299,7 +1299,7 @@ static int route_add_and_setup_timer_one(Link *link, const Route *route, const M
                         return log_link_error_errno(link, r, "Could not arm expiration timer: %m");
         }
 
-        sd_event_source_unref(nr->expire);
+        sd_event_source_disable_unref(nr->expire);
         nr->expire = TAKE_PTR(expire);
 
         *ret = nr;