From 95bdc091b2c0fe6c31e65e486b172cfba939e806 Mon Sep 17 00:00:00 2001 From: Simon Arlott Date: Sun, 30 Oct 2016 12:05:45 +0000 Subject: [PATCH] free cache emptyline rb_dlink_node, allocated automatically but never freed ==00:00:01:09.081 1762== 48 bytes in 2 blocks are definitely lost in loss record 545 of 991 ==00:00:01:09.081 1762== at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==00:00:01:09.081 1762== by 0x56C14A2: rb_malloc (rb_memory.h:41) ==00:00:01:09.081 1762== by 0x56C177C: rb_bh_alloc (balloc.c:189) ==00:00:01:09.081 1762== by 0x56CA0A9: rb_make_rb_dlink_node (tools.c:65) ==00:00:01:09.081 1762== by 0x4E52D85: cache_file (cache.c:146) ==00:00:01:09.081 1762== by 0x4E52AC3: init_cache (cache.c:67) ==00:00:01:09.081 1762== by 0x4E69530: charybdis_main (ircd.c:762) ==00:00:01:09.081 1762== by 0x400815: main (main.c:8) ==00:00:01:09.100 1762== 2,808 bytes in 117 blocks are definitely lost in loss record 960 of 991 ==00:00:01:09.100 1762== at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==00:00:01:09.100 1762== by 0x56C14A2: rb_malloc (rb_memory.h:41) ==00:00:01:09.100 1762== by 0x56C177C: rb_bh_alloc (balloc.c:189) ==00:00:01:09.100 1762== by 0x56CA0A9: rb_make_rb_dlink_node (tools.c:65) ==00:00:01:09.100 1762== by 0x4E52D85: cache_file (cache.c:146) ==00:00:01:09.100 1762== by 0x4E5337A: load_help (cache.c:301) ==00:00:01:09.100 1762== by 0x4E698AA: charybdis_main (ircd.c:848) ==00:00:01:09.100 1762== by 0x400815: main (main.c:8) ==00:00:01:09.100 1762== 5,328 (5,304 direct, 24 indirect) bytes in 221 blocks are definitely lost in loss record 971 of 991 ==00:00:01:09.100 1762== at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==00:00:01:09.100 1762== by 0x56C14A2: rb_malloc (rb_memory.h:41) ==00:00:01:09.100 1762== by 0x56C177C: rb_bh_alloc (balloc.c:189) ==00:00:01:09.100 1762== by 0x56CA0A9: rb_make_rb_dlink_node (tools.c:65) ==00:00:01:09.100 1762== by 0x4E52D85: cache_file (cache.c:146) ==00:00:01:09.100 1762== by 0x4E53278: load_help (cache.c:266) ==00:00:01:09.100 1762== by 0x4E698AA: charybdis_main (ircd.c:848) ==00:00:01:09.100 1762== by 0x400815: main (main.c:8) --- src/cache.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cache.c b/src/cache.c index 88dab60d..7369abea 100644 --- a/src/cache.c +++ b/src/cache.c @@ -220,6 +220,10 @@ free_cachefile(struct cachefile *cacheptr) rb_free(line->data); rb_free(line); } + else + { + rb_free_rb_dlink_node(ptr); + } } rb_free(cacheptr);