Has anyone on this mailing list heard of Coverity? I
am evaluating it in a desperate attempt to find a bug in
my code. When I run it in debug mode, nothing breaks. When
my program runs in release mode, it gets an access violation
after a couple of days running, which could be anything.
Anyway, one of the things Coverity uncovered is called
FORWARD NULL. Here is an example below from ptw32_throw.c,
Event var_compare_op: Added "sp" due to comparison "sp == 0"
At conditional (1): "sp == 0" taking true path
68 if (NULL == sp || sp->implicit)
71 * We're inside a non-POSIX initialised Win32 thread
72 * so there is no point to jump or throw back to. Just do an
73 * explicit thread exit here after cleaning up POSIX
74 * residue (i.e. cleanup handlers, POSIX thread handle etc).
76 unsigned exitCode = 0;
78 switch (exception)
80 case PTW32_EPS_CANCEL:
81 exitCode = (unsigned) PTHREAD_CANCELED;
At conditional (2): "exception == 1" taking true path
83 case PTW32_EPS_EXIT:
Event var_deref_op: Variable "sp" tracked as NULL was dereferenced.
84 exitCode = (unsigned) sp->exitStatus;;
In other words, if sp shows to be null at line 68, it should not be
dereferenced at line 84. I can show some others, but I am not sure
if they are significant.