libnet_cq.c:139:18: warning: dereference of possibly-NULL ‘new_18’ [CWE-690] [-Wanalyzer-possible-null-dereference]
139 | new->context = l;
| ~~~~~~~~~~~~~^~~
‘libnet_cq_add.part.0’: events 1-6
|
| 71 | libnet_cq_add(libnet_t *l, char *label)
| | ^~~~~~~~~~~~~
| | |
| | (1) entry to ‘libnet_cq_add.part.0’
|......
| 89 | if (label == NULL)
| | ~
| | |
| | (2) following ‘false’ branch (when ‘label_1(D)’ is non-NULL)...
|......
| 97 | if (l_cq == NULL)
| | ~~ ~
| | | |
| | | (4) following ‘false’ branch...
| | (3) ...to here
|......
| 124 | if (libnet_cq_dup_check(l, label))
| | ~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | | |
| | | (6) calling ‘libnet_cq_dup_check’ from ‘libnet_cq_add.part.0’
| | (5) ...to here
|
+--> ‘libnet_cq_dup_check’: events 7-13
|
| 269 | libnet_cq_dup_check(libnet_t *l, char *label)
| | ^~~~~~~~~~~~~~~~~~~
| | |
| | (7) entry to ‘libnet_cq_dup_check’
|......
| 273 | for (p = l_cq; p; p = p->next)
| | ~ ~~~~~~~~~~~
| | | |
| | | (13) ...to here
| | (8) following ‘true’ branch (when ‘p_6’ is non-NULL)...
| 274 | {
| 275 | if (p->context == l)
| | ~~ ~
| | | |
| | | (10) following ‘false’ branch...
| | (9) ...to here
|......
| 281 | if (strncmp(p->context->label, label, LIBNET_LABEL_SIZE) == 0)
| | ~~ ~
| | | |
| | | (12) following ‘false’ branch...
| | (11) ...to here
|
<------+
|
‘libnet_cq_add.part.0’: events 14-20
|
| 124 | if (libnet_cq_dup_check(l, label))
| | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | ||
| | |(14) returning to ‘libnet_cq_add.part.0’ from ‘libnet_cq_dup_check’
| | (15) following ‘false’ branch...
|......
| 130 | new = (libnet_cq_t *)malloc(sizeof (libnet_cq_t));
| | ~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | | |
| | | (17) this call could return NULL
| | (16) ...to here
| 131 | if (l_cq == NULL)
| | ~
| | |
| | (18) following ‘false’ branch...
|......
| 139 | new->context = l;
| | ~~~~~~~~~~~~~~~~
| | | |
| | | (20) ‘new_18’ could be NULL: unchecked value from (17)
| | (19) ...to here
|
Signed-off-by: Adrian Reber <areber@redhat.com>