aboutsummaryrefslogtreecommitdiff
path: root/src/librc
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-03-29 07:29:07 +0100
committerWilliam Hubbs <w.d.hubbs@gmail.com>2022-05-08 14:56:26 -0500
commit14835a22627388f2ae0f121ef5aa075c5e5706da (patch)
tree5af5ec7295a5053bad2c917b64a5081aebe8bccc /src/librc
parent3054046e18332ca1bf9b901f69b02f21bb91c098 (diff)
librc: fix memory leak in rc_services_in_runlevel_stacked
Seen on running rc-status. ``` ================================================================= ==14636==ERROR: LeakSanitizer: detected memory leaks Indirect leak of 72 byte(s) in 3 object(s) allocated from: #0 0x7f443412dcb7 in __interceptor_malloc /usr/src/debug/sys-devel/gcc-11.2.1_p20220312/gcc-11-20220312/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x7f443400c727 in xmalloc ../src/includes/helpers.h:64 #2 0x7f443400d1f4 in rc_stringlist_add ../src/librc/librc-stringlist.c:32 #3 0x7f4433fecc34 in get_runlevel_chain ../src/librc/librc.c:390 #4 0x7f4433fedc00 in rc_runlevel_stacks ../src/librc/librc.c:519 #5 0x7f4433ff1d8e in rc_services_in_runlevel_stacked ../src/librc/librc.c:976 #6 0x55be0e8f9517 in main ../src/rc/rc-status.c:407 #7 0x7f44334736cf in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 ``` Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'src/librc')
-rw-r--r--src/librc/librc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/librc/librc.c b/src/librc/librc.c
index 8fad0fa7..8841394a 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -979,6 +979,7 @@ rc_services_in_runlevel_stacked(const char *runlevel)
TAILQ_CONCAT(list, sl, entries);
free(sl);
}
+ rc_stringlist_free(stacks);
return list;
}