implied: use a time based timeout instead of counting ->nr_children
[smatch.git] / validation / sm_null_deref2.c
blob94c38dea9bb694e52675c0479540571374314dbe
1 int *ptr;
2 int x, y, z;
3 void frob(void) {
4 if ((y && !ptr) || z)
5 return;
6 if (ptr) {
7 /* in the current version of smatch this erases
8 the old implications. Later version should
9 fix this. --Dec 2 2009 */
10 x = *ptr;
12 if (!y && ptr)
13 *ptr = 0; // smatch used to print an error here.
14 if (!y)
15 *ptr = 1;
18 * check-name: Dereferencing Undefined
19 * check-command: smatch sm_null_deref2.c
21 * check-output-start
22 sm_null_deref2.c:15 frob() error: we previously assumed 'ptr' could be null (see line 12)
23 * check-output-end