]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal-remote: zero-initialize MHD daemon wrapper
authorLuca Boccassi <luca.boccassi@gmail.com>
Fri, 10 Jul 2026 15:09:49 +0000 (16:09 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 15 Jul 2026 20:13:24 +0000 (21:13 +0100)
MHDDaemonWrapper_free() unconditionally unrefs both event sources, but
setup_microhttpd_server() could return before initializing either pointer.
Zero-initialize the wrapper so cleanup after MHD startup failures safely
unrefs NULL.

Follow-up for 3c67c8bd4c5784bbcc644e489b9a39c0d2bc0e42

src/journal-remote/journal-remote-main.c

index 504471fc8af7a037e28e74079c444b05ba8a148f..afa4e55edfc0b672a60263303e3d5ae5e7f4ad89 100644 (file)
@@ -532,8 +532,9 @@ static int setup_microhttpd_server(RemoteServer *s,
         d = new(MHDDaemonWrapper, 1);
         if (!d)
                 return log_oom();
-
-        d->fd = (uint64_t) fd;
+        *d = (MHDDaemonWrapper) {
+                .fd = (uint64_t) fd,
+        };
 
         d->daemon = sym_MHD_start_daemon(
                         flags,