Project

General

Profile

Actions

Bug #7813

open

cppcheck: warnings in counters.c

Added by Victor Julien about 6 hours ago.

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

Description

src/counters.c:1108:13: warning: If memory allocation fails, then there is a possible null pointer dereference: id [nullPointerOutOfMemory]
            id->id = counters_global_id++;
            ^
src/counters.c:1106:26: note: Assuming allocation function fails
            id = SCCalloc(1, sizeof(*id));
                         ^
src/counters.c:1106:26: note: Assignment 'id=calloc(1,sizeof(*id))', assigned value is 0
            id = SCCalloc(1, sizeof(*id));
                         ^
src/counters.c:1108:13: note: Null pointer dereference
            id->id = counters_global_id++;
            ^
src/counters.c:1109:13: warning: If memory allocation fails, then there is a possible null pointer dereference: id [nullPointerOutOfMemory]
            id->string = pc->name;
            ^
src/counters.c:1106:26: note: Assuming allocation function fails
            id = SCCalloc(1, sizeof(*id));
                         ^
src/counters.c:1106:26: note: Assignment 'id=calloc(1,sizeof(*id))', assigned value is 0
            id = SCCalloc(1, sizeof(*id));
                         ^
src/counters.c:1109:13: note: Null pointer dereference
            id->string = pc->name;
            ^
src/counters.c:1116:19: warning: If memory allocation fails, then there is a possible null pointer dereference: id [nullPointerOutOfMemory]
        pc->gid = id->id;
                  ^
src/counters.c:1106:26: note: Assuming allocation function fails
            id = SCCalloc(1, sizeof(*id));
                         ^
src/counters.c:1106:26: note: Assignment 'id=calloc(1,sizeof(*id))', assigned value is 0
            id = SCCalloc(1, sizeof(*id));
                         ^
src/counters.c:1116:19: note: Null pointer dereference
        pc->gid = id->id;
                  ^

No data to display

Actions

Also available in: Atom PDF