Hello,

gcc 10 now includes static analyzer
https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html


findings mostly correlate to coverity

for example


src/peers.c: In function ‘peers_register_table’:
src/peers.c:2984:13: warning: dereference of possibly-NULL ‘st’ [CWE-690]
[-Wanalyzer-possible-null-dereference]
 2984 |   st->table = table;
      |   ~~~~~~~~~~^~~~~~~
  ‘peers_register_table’: events 1-4
    |
    | 2982 |  for (curpeer = peers->remote; curpeer; curpeer =
curpeer->next) {
    |      |  ^~~
    |      |  |
    |      |  (1) following ‘true’ branch (when ‘curpeer’ is non-NULL)...
    | 2983 |   st = calloc(1,sizeof(*st));
    |      |   ~~
    |      |   |
    |      |   (2) ...to here
    |      |   (3) this call could return NULL
    | 2984 |   st->table = table;
    |      |   ~~~~~~~~~~~~~~~~~
    |      |             |
    |      |             (4) ‘st’ could be NULL: unchecked value from (3)
    |

Reply via email to