From: Philippe Antoine Date: Mon, 27 Nov 2023 12:40:44 +0000 (+0100) Subject: source: fix resource leak X-Git-Tag: suricata-8.0.0-beta1~2030 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F9907%2Fhead;p=thirdparty%2Fsuricata.git source: fix resource leak CID: 1426081 --- diff --git a/src/source-pcap-file.c b/src/source-pcap-file.c index e54a607d48..c4f97bc0c4 100644 --- a/src/source-pcap-file.c +++ b/src/source-pcap-file.c @@ -288,6 +288,7 @@ TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, const void *initdata, void **d pv->filename = SCStrdup((char*)initdata); if (unlikely(pv->filename == NULL)) { SCLogError("Failed to allocate filename"); + closedir(directory); CleanupPcapFileDirectoryVars(pv); CleanupPcapFileThreadVars(ptv); SCReturnInt(TM_ECODE_OK); @@ -309,6 +310,7 @@ TmEcode ReceivePcapFileThreadInit(ThreadVars *tv, const void *initdata, void **d if (pv->should_recurse == true && pv->should_loop == true) { SCLogError("Error, --pcap-file-continuous and --pcap-file-recursive " "cannot be used together."); + closedir(directory); CleanupPcapFileDirectoryVars(pv); CleanupPcapFileThreadVars(ptv); SCReturnInt(TM_ECODE_FAILED);