mirror of https://github.com/OISF/suricata
output-json-email: fix memleak
This patch fixes some error handling in code generating JSON output for email event. This fixes: Indirect leak of 128 byte(s) in 1 object(s) allocated from: #0 0x50c142 in malloc (/home/eric/git/oisf/src/.libs/lt-suricata+0x50c142) #1 0x7ff92394771c (/usr/lib/x86_64-linux-gnu/libjansson.so.4+0x371c) #2 0x1bd3309 in JsonEmailLogJson /home/eric/git/oisf/src/output-json-email-common.c:376:19 #3 0x1bfe774 in JsonSmtpLogger /home/eric/git/oisf/src/output-json-smtp.c:103:9 #4 0x1c378ff in OutputTxLog /home/eric/git/oisf/src/output-tx.c:165:17 #5 0x1f94ef3 in TmThreadsSlotVarRun /home/eric/git/oisf/src/tm-threads.c:134:17 #6 0x1d33478 in TmThreadsSlotProcessPkt /home/eric/git/oisf/src/./tm-threads.h:150:9 #7 0x1d32dd4 in PcapFileCallbackLoop /home/eric/git/oisf/src/source-pcap-file.c:184:9 #8 0x7ff924199013 (/usr/lib/x86_64-linux-gnu/libpcap.so.0.8+0x1f013) Indirect leak of 96 byte(s) in 3 object(s) allocated from: #0 0x50c142 in malloc (/home/eric/git/oisf/src/.libs/lt-suricata+0x50c142) #1 0x7ff92394bc7b (/usr/lib/x86_64-linux-gnu/libjansson.so.4+0x7c7b) Indirect leak of 82 byte(s) in 3 object(s) allocated from: #0 0x50c142 in malloc (/home/eric/git/oisf/src/.libs/lt-suricata+0x50c142) #1 0x7ff923949924 (/usr/lib/x86_64-linux-gnu/libjansson.so.4+0x5924) Indirect leak of 72 byte(s) in 1 object(s) allocated from: #0 0x50c142 in malloc (/home/eric/git/oisf/src/.libs/lt-suricata+0x50c142) #1 0x7ff92394bcda in json_object (/usr/lib/x86_64-linux-gnu/libjansson.so.4+0x7cda) #2 0x1bd3309 in JsonEmailLogJson /home/eric/git/oisf/src/output-json-email-common.c:376:19 #3 0x1bfe774 in JsonSmtpLogger /home/eric/git/oisf/src/output-json-smtp.c:103:9 #4 0x1c378ff in OutputTxLog /home/eric/git/oisf/src/output-tx.c:165:17 #5 0x1f94ef3 in TmThreadsSlotVarRun /home/eric/git/oisf/src/tm-threads.c:134:17 #6 0x1d33478 in TmThreadsSlotProcessPkt /home/eric/git/oisf/src/./tm-threads.h:150:9 #7 0x1d32dd4 in PcapFileCallbackLoop /home/eric/git/oisf/src/source-pcap-file.c:184:9 #8 0x7ff924199013 (/usr/lib/x86_64-linux-gnu/libpcap.so.0.8+0x1f013) Indirect leak of 64 byte(s) in 1 object(s) allocated from: #0 0x50c142 in malloc (/home/eric/git/oisf/src/.libs/lt-suricata+0x50c142) #1 0x7ff92394bf5a in json_array (/usr/lib/x86_64-linux-gnu/libjansson.so.4+0x7f5a) #2 0x1bd04b5 in JsonEmailLogJsonData /home/eric/git/oisf/src/output-json-email-common.c:296:27 #3 0x1bd3309 in JsonEmailLogJson /home/eric/git/oisf/src/output-json-email-common.c:376:19 #4 0x1bfe774 in JsonSmtpLogger /home/eric/git/oisf/src/output-json-smtp.c:103:9 #5 0x1c378ff in OutputTxLog /home/eric/git/oisf/src/output-tx.c:165:17 #6 0x1f94ef3 in TmThreadsSlotVarRun /home/eric/git/oisf/src/tm-threads.c:134:17 #7 0x1d33478 in TmThreadsSlotProcessPkt /home/eric/git/oisf/src/./tm-threads.h:150:9 #8 0x1d32dd4 in PcapFileCallbackLoop /home/eric/git/oisf/src/source-pcap-file.c:184:9 #9 0x7ff924199013 (/usr/lib/x86_64-linux-gnu/libpcap.so.0.8+0x1f013) Indirect leak of 48 byte(s) in 1 object(s) allocated from: #0 0x50c142 in malloc (/home/eric/git/oisf/src/.libs/lt-suricata+0x50c142) #1 0x7ff92394bf2a in json_array (/usr/lib/x86_64-linux-gnu/libjansson.so.4+0x7f2a) #2 0x1bd04b5 in JsonEmailLogJsonData /home/eric/git/oisf/src/output-json-email-common.c:296:27 #3 0x1bd3309 in JsonEmailLogJson /home/eric/git/oisf/src/output-json-email-common.c:376:19 #4 0x1bfe774 in JsonSmtpLogger /home/eric/git/oisf/src/output-json-smtp.c:103:9 #5 0x1c378ff in OutputTxLog /home/eric/git/oisf/src/output-tx.c:165:17 #6 0x1f94ef3 in TmThreadsSlotVarRun /home/eric/git/oisf/src/tm-threads.c:134:17 #7 0x1d33478 in TmThreadsSlotProcessPkt /home/eric/git/oisf/src/./tm-threads.h:150:9 #8 0x1d32dd4 in PcapFileCallbackLoop /home/eric/git/oisf/src/source-pcap-file.c:184:9 #9 0x7ff924199013 (/usr/lib/x86_64-linux-gnu/libpcap.so.0.8+0x1f013)pull/1954/head
parent
a05cdbdf28
commit
1b1cde6837
Loading…
Reference in New Issue