Project

General

Profile

Actions

Bug #2870

closed

pcap logging with lz4 coverity warning

Added by Victor Julien almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

This next one is in the #ifdef HAVE_LIBLZ4 code. It seems to forget about
calling:

        SCFree(copy->h);
        SCFree(copy);

on the error paths.

Error: RESOURCE_LEAK (CWE-772):
suricata-4.1.3/src/log-pcap.c:606: alloc_fn: Storage is returned from allocation function "calloc".
suricata-4.1.3/src/log-pcap.c:606: var_assign: Assigning: "ptrmem" = storage returned from "calloc(1UL, 4608UL)".
suricata-4.1.3/src/log-pcap.c:606: leaked_storage: Variable "ptrmem" going out of scope leaks the storage it points to.
suricata-4.1.3/src/log-pcap.c:606: var_assign: Assigning: "copy" = "({...; (void *)ptrmem;})".
suricata-4.1.3/src/log-pcap.c:636: var_assign: Assigning: "copy_comp" = "copy".
suricata-4.1.3/src/log-pcap.c:653: leaked_storage: Variable "copy_comp" going out of scope leaks the storage it points to.
suricata-4.1.3/src/log-pcap.c:653: leaked_storage: Variable "copy" going out of scope leaks the storage it points to.
#  651|               SCLogError(SC_ERR_MEM_ALLOC, "SCMalloc failed: %s",
#  652|                       strerror(errno));
#  653|->             return NULL;
#  654|           }
#  655|           copy_comp->pcap_buf = SCMalloc(copy_comp->pcap_buf_siz


Related issues 1 (0 open1 closed)

Copied to Suricata - Bug #2901: pcap logging with lz4 coverity warning (master)ClosedMax FillingerActions
Actions

Also available in: Atom PDF