function_hooks: add some calls to __unnullify_path()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 14 Dec 2012 12:24:09 +0000 (14 15:24 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Fri, 14 Dec 2012 12:24:09 +0000 (14 15:24 +0300)
The problem is that we call a function:
some_func(x, y, z);

We want to create an slist for each return path in some_func().  If we were
storing the return value then it wouldn't be a problem.  But since we're
not there could be a return path which doesn't set any states so it gets
ignored.  This is why return_markers exist so that we know when to call
__unnullify_path().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_function_hooks.c

index 4903581..defd63c 100644 (file)
@@ -693,6 +693,7 @@ static int db_return_states_callback(void *unused, int argc, char **argv, char *
                slist = __pop_fake_cur_slist();
                merge_slist(&db_info.slist, slist);
                __push_fake_cur_slist();
+               __unnullify_path();
        }
        prev_return_id = return_id;
 
@@ -731,6 +732,7 @@ static void db_return_states(struct expression *expr)
        db_info.expr = expr;
        db_info.slist = NULL;
        __push_fake_cur_slist();
+       __unnullify_path();
        run_sql(db_return_states_callback,
                "select return_id, return, type, parameter, key, value from return_states where %s",
                sql_filter);