Project

General

Profile

Actions

Bug #2901

closed

pcap logging with lz4 coverity warning (master)

Added by Victor Julien about 5 years ago. Updated about 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 from Suricata - Bug #2870: pcap logging with lz4 coverity warningClosedMax FillingerActions
Actions #1

Updated by Victor Julien about 5 years ago

  • Copied from Bug #2870: pcap logging with lz4 coverity warning added
Actions #2

Updated by Victor Julien about 5 years ago

  • Status changed from Assigned to Closed
  • Target version changed from 4.1.4 to 5.0beta1
Actions

Also available in: Atom PDF