Skip to content

Commit

Permalink
source: fix resource leak
Browse files Browse the repository at this point in the history
CID: 1426081
  • Loading branch information
catenacyber authored and victorjulien committed Nov 27, 2023
1 parent 5954a91 commit 9c3ab36
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/source-pcap-file.c
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 9c3ab36

Please sign in to comment.