Menu

#274 Possible NULL pointer dereference in hunspell.cxx:616

v1.0 (example)
open
nobody
None
5
2015-05-27
2015-05-27
No

Visual Studio code analysis picked this up, a C6011.

In function pipe_interface, at the line:

i->word = mystrdup(buf+1);

....Hunspell dereferences i, which was malloc'd the line before, as:

struct wordlist* i = 
(struct wordlist *) malloc (sizeof(struct wordlist));

....and never checked against NULL. Sure, it's a rare condition, but a valid one nonetheless.

C6011   Dereferencing NULL pointer 'i'.
    614 'i' may be NULL
    616 'i' is dereferenced, but may still be NULL

Discussion