summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-11-20 09:54:31 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-11-20 16:48:21 +0100
commit7add4883cbda366f6bad123e2e748f29d53a448c (patch)
treee9dbe1987b4118abfe581ec24253f3a031183a59 /src
parentcoredumpctl: define main through macro (diff)
downloadsystemd-7add4883cbda366f6bad123e2e748f29d53a448c.tar.xz
systemd-7add4883cbda366f6bad123e2e748f29d53a448c.zip
coredumpctl: fix "leak" of bus connection
$ valgrind --show-leak-kinds=all --leak-check=full build/coredumpctl dump --output /tmp/ff ... ==16431== HEAP SUMMARY: ==16431== in use at exit: 3,680 bytes in 13 blocks ==16431== total heap usage: 831 allocs, 818 frees, 197,776 bytes allocated ==16431== ==16431== 2 bytes in 1 blocks are still reachable in loss record 1 of 13 ==16431== at 0x483880B: malloc (vg_replace_malloc.c:299) ==16431== by 0x4C4D5AD: strdup (strdup.c:42) ==16431== by 0x49B2387: bus_message_parse_fields (bus-message.c:5300) ==16431== by 0x49A23AF: bus_message_from_malloc (bus-message.c:560) ==16431== by 0x49C459B: bus_socket_make_message (bus-socket.c:1099) ==16431== by 0x49C4C5B: bus_socket_read_message (bus-socket.c:1213) ==16431== by 0x49CE4CE: bus_read_message (sd-bus.c:1777) ==16431== by 0x49CFA2C: sd_bus_call (sd-bus.c:2176) ==16431== by 0x1105F3: check_units_active (coredumpctl.c:1029) ==16431== by 0x110998: run (coredumpctl.c:1087) ==16431== by 0x110A45: main (coredumpctl.c:1100) ==16431== ==16431== 9 bytes in 1 blocks are still reachable in loss record 2 of 13 ==16431== at 0x483880B: malloc (vg_replace_malloc.c:299) ==16431== by 0x4939067: malloc_multiply (alloc-util.h:78) ==16431== by 0x493921D: hexmem (hexdecoct.c:62) ==16431== by 0x49C2B75: bus_socket_start_auth_client (bus-socket.c:626) ==16431== by 0x49C2D78: bus_socket_start_auth (bus-socket.c:665) ==16431== by 0x49C3B09: bus_socket_connect (bus-socket.c:915) ==16431== by 0x49CBB08: bus_start_address (sd-bus.c:1103) ==16431== by 0x49CBFEA: sd_bus_start (sd-bus.c:1187) ==16431== by 0x49CC452: sd_bus_open_system_with_description (sd-bus.c:1294) ==16431== by 0x49CC4C6: sd_bus_open_system (sd-bus.c:1303) ==16431== by 0x49D4424: bus_default (sd-bus.c:3655) ==16431== by 0x49D44BC: sd_bus_default_system (sd-bus.c:3668) ==16431== ==16431== 9 bytes in 1 blocks are still reachable in loss record 3 of 13 ==16431== at 0x483880B: malloc (vg_replace_malloc.c:299) ==16431== by 0x4C4D5AD: strdup (strdup.c:42) ==16431== by 0x497364E: free_and_strdup (string-util.c:1013) ==16431== by 0x49C9FB1: hello_callback (sd-bus.c:547) ==16431== by 0x49D0A3A: process_reply (sd-bus.c:2498) ==16431== by 0x49D13E0: process_message (sd-bus.c:2677) ==16431== by 0x49D165F: process_running (sd-bus.c:2739) ==16431== by 0x49D20DD: bus_process_internal (sd-bus.c:2957) ==16431== by 0x49D21E8: sd_bus_process (sd-bus.c:2984) ==16431== by 0x49CF21E: bus_ensure_running (sd-bus.c:2053) ==16431== by 0x49CF51F: sd_bus_call (sd-bus.c:2095) ==16431== by 0x1105F3: check_units_active (coredumpctl.c:1029) ==16431== ==16431== 24 bytes in 1 blocks are still reachable in loss record 4 of 13 ==16431== at 0x483880B: malloc (vg_replace_malloc.c:299) ==16431== by 0x495CB0D: malloc_multiply (alloc-util.h:78) ==16431== by 0x495CB2A: prioq_new (prioq.c:35) ==16431== by 0x495CC02: prioq_ensure_allocated (prioq.c:60) ==16431== by 0x49CEF84: sd_bus_call_async (sd-bus.c:1995) ==16431== by 0x49CA0E6: bus_send_hello (sd-bus.c:581) ==16431== by 0x49CC019: sd_bus_start (sd-bus.c:1196) ==16431== by 0x49CC452: sd_bus_open_system_with_description (sd-bus.c:1294) ==16431== by 0x49CC4C6: sd_bus_open_system (sd-bus.c:1303) ==16431== by 0x49D4424: bus_default (sd-bus.c:3655) ==16431== by 0x49D44BC: sd_bus_default_system (sd-bus.c:3668) ==16431== by 0x110444: check_units_active (coredumpctl.c:1007) ==16431== ==16431== 38 bytes in 1 blocks are still reachable in loss record 5 of 13 ==16431== at 0x483880B: malloc (vg_replace_malloc.c:299) ==16431== by 0x4C4D5AD: strdup (strdup.c:42) ==16431== by 0x497364E: free_and_strdup (string-util.c:1013) ==16431== by 0x49C7F97: sd_bus_set_address (sd-bus.c:269) ==16431== by 0x49CC314: bus_set_address_system (sd-bus.c:1262) ==16431== by 0x49CC3E0: sd_bus_open_system_with_description (sd-bus.c:1281) ==16431== by 0x49CC4C6: sd_bus_open_system (sd-bus.c:1303) ==16431== by 0x49D4424: bus_default (sd-bus.c:3655) ==16431== by 0x49D44BC: sd_bus_default_system (sd-bus.c:3668) ==16431== by 0x110444: check_units_active (coredumpctl.c:1007) ==16431== by 0x110998: run (coredumpctl.c:1087) ==16431== by 0x110A45: main (coredumpctl.c:1100) ==16431== ==16431== 64 bytes in 1 blocks are still reachable in loss record 6 of 13 ==16431== at 0x4838748: malloc (vg_replace_malloc.c:298) ==16431== by 0x483AD63: realloc (vg_replace_malloc.c:826) ==16431== by 0x4902663: greedy_realloc (alloc-util.c:55) ==16431== by 0x49C7D7D: sd_bus_new (sd-bus.c:255) ==16431== by 0x49CC398: sd_bus_open_system_with_description (sd-bus.c:1271) ==16431== by 0x49CC4C6: sd_bus_open_system (sd-bus.c:1303) ==16431== by 0x49D4424: bus_default (sd-bus.c:3655) ==16431== by 0x49D44BC: sd_bus_default_system (sd-bus.c:3668) ==16431== by 0x110444: check_units_active (coredumpctl.c:1007) ==16431== by 0x110998: run (coredumpctl.c:1087) ==16431== by 0x110A45: main (coredumpctl.c:1100) ==16431== ==16431== 64 bytes in 1 blocks are still reachable in loss record 7 of 13 ==16431== at 0x4838748: malloc (vg_replace_malloc.c:298) ==16431== by 0x483AD63: realloc (vg_replace_malloc.c:826) ==16431== by 0x4902663: greedy_realloc (alloc-util.c:55) ==16431== by 0x49CE54E: bus_rqueue_make_room (sd-bus.c:1786) ==16431== by 0x49C44FC: bus_socket_make_message (bus-socket.c:1087) ==16431== by 0x49C4C5B: bus_socket_read_message (bus-socket.c:1213) ==16431== by 0x49CE4CE: bus_read_message (sd-bus.c:1777) ==16431== by 0x49CE6AF: dispatch_rqueue (sd-bus.c:1814) ==16431== by 0x49D162E: process_running (sd-bus.c:2733) ==16431== by 0x49D20DD: bus_process_internal (sd-bus.c:2957) ==16431== by 0x49D21E8: sd_bus_process (sd-bus.c:2984) ==16431== by 0x49CF21E: bus_ensure_running (sd-bus.c:2053) ==16431== ==16431== 65 bytes in 1 blocks are still reachable in loss record 8 of 13 ==16431== at 0x483AB1A: calloc (vg_replace_malloc.c:752) ==16431== by 0x496E5D6: getpeersec (socket-util.c:969) ==16431== by 0x49C291C: bus_get_peercred (bus-socket.c:594) ==16431== by 0x49C2CB2: bus_socket_start_auth (bus-socket.c:650) ==16431== by 0x49C3B09: bus_socket_connect (bus-socket.c:915) ==16431== by 0x49CBB08: bus_start_address (sd-bus.c:1103) ==16431== by 0x49CBFEA: sd_bus_start (sd-bus.c:1187) ==16431== by 0x49CC452: sd_bus_open_system_with_description (sd-bus.c:1294) ==16431== by 0x49CC4C6: sd_bus_open_system (sd-bus.c:1303) ==16431== by 0x49D4424: bus_default (sd-bus.c:3655) ==16431== by 0x49D44BC: sd_bus_default_system (sd-bus.c:3668) ==16431== by 0x110444: check_units_active (coredumpctl.c:1007) ==16431== ==16431== 181 bytes in 1 blocks are still reachable in loss record 9 of 13 ==16431== at 0x483AD19: realloc (vg_replace_malloc.c:826) ==16431== by 0x49C4791: bus_socket_read_message (bus-socket.c:1143) ==16431== by 0x49CE4CE: bus_read_message (sd-bus.c:1777) ==16431== by 0x49CFA2C: sd_bus_call (sd-bus.c:2176) ==16431== by 0x1105F3: check_units_active (coredumpctl.c:1029) ==16431== by 0x110998: run (coredumpctl.c:1087) ==16431== by 0x110A45: main (coredumpctl.c:1100) ==16431== ==16431== 256 bytes in 1 blocks are still reachable in loss record 10 of 13 ==16431== at 0x483880B: malloc (vg_replace_malloc.c:299) ==16431== by 0x496E740: getpeergroups (socket-util.c:998) ==16431== by 0x49C29BD: bus_get_peercred (bus-socket.c:599) ==16431== by 0x49C2CB2: bus_socket_start_auth (bus-socket.c:650) ==16431== by 0x49C3B09: bus_socket_connect (bus-socket.c:915) ==16431== by 0x49CBB08: bus_start_address (sd-bus.c:1103) ==16431== by 0x49CBFEA: sd_bus_start (sd-bus.c:1187) ==16431== by 0x49CC452: sd_bus_open_system_with_description (sd-bus.c:1294) ==16431== by 0x49CC4C6: sd_bus_open_system (sd-bus.c:1303) ==16431== by 0x49D4424: bus_default (sd-bus.c:3655) ==16431== by 0x49D44BC: sd_bus_default_system (sd-bus.c:3668) ==16431== by 0x110444: check_units_active (coredumpctl.c:1007) ==16431== ==16431== 256 bytes in 1 blocks are still reachable in loss record 11 of 13 ==16431== at 0x4838748: malloc (vg_replace_malloc.c:298) ==16431== by 0x483AD63: realloc (vg_replace_malloc.c:826) ==16431== by 0x495D1A0: prioq_put (prioq.c:162) ==16431== by 0x49CF0EA: sd_bus_call_async (sd-bus.c:2023) ==16431== by 0x49CA0E6: bus_send_hello (sd-bus.c:581) ==16431== by 0x49CC019: sd_bus_start (sd-bus.c:1196) ==16431== by 0x49CC452: sd_bus_open_system_with_description (sd-bus.c:1294) ==16431== by 0x49CC4C6: sd_bus_open_system (sd-bus.c:1303) ==16431== by 0x49D4424: bus_default (sd-bus.c:3655) ==16431== by 0x49D44BC: sd_bus_default_system (sd-bus.c:3668) ==16431== by 0x110444: check_units_active (coredumpctl.c:1007) ==16431== by 0x110998: run (coredumpctl.c:1087) ==16431== ==16431== 856 bytes in 1 blocks are still reachable in loss record 12 of 13 ==16431== at 0x483AB1A: calloc (vg_replace_malloc.c:752) ==16431== by 0x49A1F33: bus_message_from_header (bus-message.c:458) ==16431== by 0x49A22B1: bus_message_from_malloc (bus-message.c:535) ==16431== by 0x49C459B: bus_socket_make_message (bus-socket.c:1099) ==16431== by 0x49C4C5B: bus_socket_read_message (bus-socket.c:1213) ==16431== by 0x49CE4CE: bus_read_message (sd-bus.c:1777) ==16431== by 0x49CFA2C: sd_bus_call (sd-bus.c:2176) ==16431== by 0x1105F3: check_units_active (coredumpctl.c:1029) ==16431== by 0x110998: run (coredumpctl.c:1087) ==16431== by 0x110A45: main (coredumpctl.c:1100) ==16431== ==16431== 1,856 bytes in 1 blocks are still reachable in loss record 13 of 13 ==16431== at 0x483880B: malloc (vg_replace_malloc.c:299) ==16431== by 0x49C6EDF: malloc_multiply (alloc-util.h:78) ==16431== by 0x49C7C81: sd_bus_new (sd-bus.c:235) ==16431== by 0x49CC398: sd_bus_open_system_with_description (sd-bus.c:1271) ==16431== by 0x49CC4C6: sd_bus_open_system (sd-bus.c:1303) ==16431== by 0x49D4424: bus_default (sd-bus.c:3655) ==16431== by 0x49D44BC: sd_bus_default_system (sd-bus.c:3668) ==16431== by 0x110444: check_units_active (coredumpctl.c:1007) ==16431== by 0x110998: run (coredumpctl.c:1087) ==16431== by 0x110A45: main (coredumpctl.c:1100) ==16431== ==16431== LEAK SUMMARY: ==16431== definitely lost: 0 bytes in 0 blocks ==16431== indirectly lost: 0 bytes in 0 blocks ==16431== possibly lost: 0 bytes in 0 blocks ==16431== still reachable: 3,680 bytes in 13 blocks ==16431== suppressed: 0 bytes in 0 blocks ==16431==
Diffstat (limited to 'src')
-rw-r--r--src/coredump/coredumpctl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c
index 4616a7e3e4..9323e9d028 100644
--- a/src/coredump/coredumpctl.c
+++ b/src/coredump/coredumpctl.c
@@ -994,7 +994,7 @@ finish:
}
static int check_units_active(void) {
- _cleanup_(sd_bus_unrefp) sd_bus *bus = NULL;
+ _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;