From 24f412ca4150b490648ab8de45c6eda5bd697fd8 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Sun, 17 Jan 2016 09:36:03 +0000 Subject: [PATCH] core: fix memory leak on set-default, enable, disable etc Fixes: ==1== by 0x23E44C: remove_marked_symlinks_fd (install.c:453) ==1== by 0x23E256: remove_marked_symlinks_fd (install.c:405) ==1== by 0x23E630: remove_marked_symlinks (install.c:494) ==1== by 0x2427A0: unit_file_disable (install.c:1876) ==1== by 0x18A633: method_disable_unit_files_generic (dbus-manager.c:1760) ==1== by 0x18A6CA: method_disable_unit_files (dbus-manager.c:1768) ==1== by 0x1D8146: method_callbacks_run (bus-objects.c:420) ==1== by 0x1DA9D8: object_find_and_run (bus-objects.c:1257) ==1== by 0x1DB01A: bus_process_object (bus-objects.c:1373) ==1== ==1== 228 (48 direct, 180 indirect) bytes in 2 blocks are definitely lost in loss record 8 of 14 ==1== at 0x4C2BBCF: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==1== by 0x4C2DE2F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==1== by 0x23DA60: unit_file_changes_add (install.c:233) ==1== by 0x23DDB2: create_symlink (install.c:298) ==1== by 0x240C5C: install_info_symlink_wants (install.c:1328) ==1== by 0x240FC8: install_info_apply (install.c:1384) ==1== by 0x241211: install_context_apply (install.c:1439) ==1== by 0x242563: unit_file_enable (install.c:1830) ==1== by 0x18A06E: method_enable_unit_files_generic (dbus-manager.c:1650) ==1== by 0x18A141: method_enable_unit_files (dbus-manager.c:1660) ==1== by 0x1D8146: method_callbacks_run (bus-objects.c:420) ==1== by 0x1DA9D8: object_find_and_run (bus-objects.c:1257) ==1== ==1== 467 (144 direct, 323 indirect) bytes in 3 blocks are definitely lost in loss record 9 of 14 ==1== at 0x4C2DD9F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==1== by 0x23DA60: unit_file_changes_add (install.c:233) ==1== by 0x23DE97: create_symlink (install.c:320) ==1== by 0x242CFC: unit_file_set_default (install.c:1951) ==1== by 0x18A881: method_set_default_target (dbus-manager.c:1802) ==1== by 0x1D8146: method_callbacks_run (bus-objects.c:420) ==1== by 0x1DA9D8: object_find_and_run (bus-objects.c:1257) ==1== by 0x1DB01A: bus_process_object (bus-objects.c:1373) ==1== by 0x259143: process_message (sd-bus.c:2567) ==1== by 0x259326: process_running (sd-bus.c:2609) ==1== by 0x259BDC: bus_process_internal (sd-bus.c:2798) ==1== by 0x259CAD: sd_bus_process (sd-bus.c:2817) ==1== ==1== LEAK SUMMARY: ==1== definitely lost: 216 bytes in 6 blocks ==1== indirectly lost: 560 bytes in 14 blocks ==1== possibly lost: 0 bytes in 0 blocks ==1== still reachable: 65,536 bytes in 5 blocks ==1== suppressed: 0 bytes in 0 blocks ==1== Reachable blocks (those to which a pointer was found) are not shown. ==1== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==1== --- src/core/dbus-manager.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 8a523cc8ac..23a16ac15e 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -1607,6 +1607,7 @@ static int reply_unit_file_changes_and_free( if (r < 0) goto fail; + unit_file_changes_free(changes, n_changes); return sd_bus_send(NULL, reply, NULL); fail: