]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-journal-send: close fd opend by syslog()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 22 Feb 2022 16:52:29 +0000 (01:52 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 22 Feb 2022 22:38:39 +0000 (07:38 +0900)
Fixes an issue reported in #22576.

src/libsystemd/sd-journal/test-journal-send.c

index 75bd8e7b856bd373e5007a9cbba0acd50b222c46..b6644e65c1abc40ea78d5bb8f5c10706ebedff90 100644 (file)
@@ -90,6 +90,10 @@ static void test_journal_send(void) {
         assert_se(sd_journal_sendv(graph2, 1) == 0);
         assert_se(sd_journal_sendv(message1, 1) == 0);
         assert_se(sd_journal_sendv(message2, 1) == 0);
+
+        /* The above syslog() opens a fd which is stored in libc, and the valgrind reports the fd is
+         * leaked when we do not call closelog(). */
+        closelog();
 }
 
 int main(int argc, char *argv[]) {