summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2016-11-03 21:23:22 +0000
committerEvgeny Vereshchagin <evvers@ya.ru>2016-11-03 21:23:22 +0000
commit12104159ed88324fa95505a6a8b333dd92a80368 (patch)
tree09f1c14caee1d6c30c0658c66ebbb88daacb9755
parent9156493171cf2d78e1ac1a3746c385b0e281acf1 (diff)
journalctl: fix memleak
bash-4.3# journalctl --no-hostname >/dev/null ================================================================= ==288==ERROR: LeakSanitizer: detected memory leaks Direct leak of 48492 byte(s) in 2694 object(s) allocated from: #0 0x7fb4aba13e60 in malloc (/lib64/libasan.so.3+0xc6e60) #1 0x7fb4ab5b2cc4 in malloc_multiply src/basic/alloc-util.h:70 #2 0x7fb4ab5b3194 in parse_field src/shared/logs-show.c:98 #3 0x7fb4ab5b4918 in output_short src/shared/logs-show.c:347 #4 0x7fb4ab5b7cb7 in output_journal src/shared/logs-show.c:977 #5 0x5650e29cd83d in main src/journal/journalctl.c:2581 #6 0x7fb4aabdb730 in __libc_start_main (/lib64/libc.so.6+0x20730) SUMMARY: AddressSanitizer: 48492 byte(s) leaked in 2694 allocation(s). Closes: #4568
-rw-r--r--src/shared/logs-show.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index f9d9c4ed62..5ad5ade31e 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -418,7 +418,7 @@ static int output_short(
if (flags & OUTPUT_NO_HOSTNAME) {
/* Suppress display of the hostname if this is requested. */
- hostname = NULL;
+ hostname = mfree(hostname);
hostname_len = 0;
}