curl-util: do not configure new io event source when the event loop is already dead
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 23 Nov 2024 16:05:47 +0000 (01:05 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 29 Nov 2024 13:26:56 +0000 (14:26 +0100)
Similar to c5ecf0949460dd0bf3211db128a385ce6375252e, but for io event source.

Fixes #35322.

(cherry picked from commit 5b2926d9414f4333153ebe0bf169e1dd76129119)

src/import/curl-util.c

index 1628f833a970a0e7d50e7438ccf3b60f5aebf927..06d20eb557698022eaf13bd08053e28a408136dd 100644 (file)
@@ -75,6 +75,10 @@ static int curl_glue_socket_callback(CURL *curl, curl_socket_t s, int action, vo
                 return 0;
         }
 
+        /* Don't configure io event source anymore when the event loop is dead already. */
+        if (g->event && sd_event_get_state(g->event) == SD_EVENT_FINISHED)
+                return 0;
+
         r = hashmap_ensure_allocated(&g->ios, &trivial_hash_ops);
         if (r < 0) {
                 log_oom();