Skip to content

Issues found with scan-build #385

Closed
Closed
@fklassen

Description

In file included from libopts.c:31:
./nested.c:345:18: warning: Value stored to 'pzScan' during its initialization is never read
   char const * pzScan = name+1; /* we know first char is a name char */
                ^~~~~~   ~~~~~~
In file included from libopts.c:32:
./numeric.c:58:9: warning: Value stored to 'pz_indent' is never read
       pz_indent = ONE_TAB_STR;
       ^           ~~~~~~~~~~~
2 warnings generated.

cidr.c:214:13: warning: Value stored to 'count' is never read
           count = sscanf(p, "%d", &newcidr->masklen);
           ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

cache.c:271:14: warning: Access to field 'packets' results in a dereference of a null pointer (loaded from variable 'lastcache')
       if ((lastcache->packets + 1) > (CACHEDATASIZE * CACHE_PACKETS_PER_BYTE)) {
            ^~~~~~~~~~~~~~~~~~
1 warning generated.

services.c:69:9: warning: Value stored to 'portc' is never read
       portc = 0;
       ^       ~
1 warning generated.

portmap.c:133:28: warning: Access to field 'next' results in a dereference of a null pointer (loaded from variable 'portmap_last')
       portmap_last->next = NULL;
       ~~~~~~~~~~~~       ^
1 warning generated.

./plugins/dlt_en10mb/en10mb.c:732:5: warning: Value stored to 'l2len' is never read
   l2len = -1;
   ^       ~~
1 warning generated.

send_packets.c:716:19: warning: Value stored to 'sp' during its initialization is never read
   sendpacket_t *sp = ctx->intf1;
                 ^~   ~~~~~~~~~~
send_packets.c:721:9: warning: Value stored to 'datalink' during its initialization is never read
   int datalink = options->file_cache[cache_file_idx1].dlt;
       ^~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.

tcpprep.c:96:5: warning: Value stored to 'argc' is never read
   argc -= optct;
   ^       ~~~~~
tcpprep.c:97:5: warning: Value stored to 'argv' is never read
   argv += optct;
   ^       ~~~~~
2 warnings generated.

tree.c:55:1: warning: Dereference of null pointer
RB_GENERATE(tcpr_data_tree_s, tcpr_tree_s, node, tree_comp)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lib/tree.h:395:17: note: expanded from macro 'RB_GENERATE'
               if (parent == RB_LEFT(gparent, field)) {                \
                             ^~~~~~~~~~~~~~~~~~~~~~~
../lib/tree.h:313:30: note: expanded from macro 'RB_LEFT'
#define RB_LEFT(elm, field)             (elm)->field.rbe_left
                                       ^~~~~~~~~~~~~~~~~~~~~
tree.c:55:1: warning: Dereference of null pointer
RB_GENERATE(tcpr_data_tree_s, tcpr_tree_s, node, tree_comp)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lib/tree.h:445:9: note: expanded from macro 'RB_GENERATE'
                       if ((RB_LEFT(tmp, field) == NULL ||             \
                            ^~~~~~~~~~~~~~~~~~~
../lib/tree.h:313:30: note: expanded from macro 'RB_LEFT'
#define RB_LEFT(elm, field)             (elm)->field.rbe_left
                                       ^~~~~~~~~~~~~~~~~~~~~
tree.c:55:1: warning: Dereference of null pointer
RB_GENERATE(tcpr_data_tree_s, tcpr_tree_s, node, tree_comp)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lib/tree.h:477:9: note: expanded from macro 'RB_GENERATE'
                       if ((RB_LEFT(tmp, field) == NULL ||             \
                            ^~~~~~~~~~~~~~~~~~~
../lib/tree.h:313:30: note: expanded from macro 'RB_LEFT'
#define RB_LEFT(elm, field)             (elm)->field.rbe_left
                                       ^~~~~~~~~~~~~~~~~~~~~
3 warnings generated.

send_packets.c:529:9: warning: Value stored to 'pktlen' is never read
       pktlen = options->use_pkthdr_len ? (COUNTER)pkthdr.len : (COUNTER)pkthdr.caplen;
       ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
send_packets.c:716:19: warning: Value stored to 'sp' during its initialization is never read
   sendpacket_t *sp = ctx->intf1;
                 ^~   ~~~~~~~~~~
send_packets.c:721:9: warning: Value stored to 'datalink' during its initialization is never read
   int datalink = options->file_cache[cache_file_idx1].dlt;
       ^~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
send_packets.c:805:9: warning: Value stored to 'pktlen' is never read
       pktlen = options->use_pkthdr_len ? (COUNTER)pkthdr_ptr->len : (COUNTER)pkthdr_ptr->caplen;
       ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.

bridge.c:65:1: warning: Dereference of null pointer
RB_GENERATE(macsrc_tree, macsrc_t, node, rbmacsrc_comp)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lib/tree.h:395:17: note: expanded from macro 'RB_GENERATE'
               if (parent == RB_LEFT(gparent, field)) {                \
                             ^~~~~~~~~~~~~~~~~~~~~~~
../lib/tree.h:313:30: note: expanded from macro 'RB_LEFT'
#define RB_LEFT(elm, field)             (elm)->field.rbe_left
                                       ^~~~~~~~~~~~~~~~~~~~~
bridge.c:65:1: warning: Dereference of null pointer
RB_GENERATE(macsrc_tree, macsrc_t, node, rbmacsrc_comp)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lib/tree.h:445:9: note: expanded from macro 'RB_GENERATE'
                       if ((RB_LEFT(tmp, field) == NULL ||             \
                            ^~~~~~~~~~~~~~~~~~~
../lib/tree.h:313:30: note: expanded from macro 'RB_LEFT'
#define RB_LEFT(elm, field)             (elm)->field.rbe_left
                                       ^~~~~~~~~~~~~~~~~~~~~
bridge.c:65:1: warning: Dereference of null pointer
RB_GENERATE(macsrc_tree, macsrc_t, node, rbmacsrc_comp)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lib/tree.h:477:9: note: expanded from macro 'RB_GENERATE'
                       if ((RB_LEFT(tmp, field) == NULL ||             \
                            ^~~~~~~~~~~~~~~~~~~
../lib/tree.h:313:30: note: expanded from macro 'RB_LEFT'
#define RB_LEFT(elm, field)             (elm)->field.rbe_left
                                       ^~~~~~~~~~~~~~~~~~~~~
3 warnings generated.

tcpliveplay.c:215:33: warning: Call to 'malloc' has an allocation size of 0 bytes
   sched = (struct tcp_sched*) malloc(num_packets*sizeof(struct tcp_sched));
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tcpliveplay.c:222:5: warning: Function call argument is an uninitialized value
   relative_sched(sched, sched[1].exp_rseq, num_packets);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tcpliveplay.c:1185:5: warning: Value stored to 'sum' is never read
   sum = 0;
   ^     ~
3 warnings generated.

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions