From: Dan Carpenter Date: Fri, 14 Dec 2012 12:24:09 +0000 (+0300) Subject: function_hooks: add some calls to __unnullify_path() X-Git-Tag: 1.57~115 X-Git-Url: https://repo.or.cz/w/smatch.git/commitdiff_plain/4eee1b3890492f6451ec577399a8ca0d286c8877 function_hooks: add some calls to __unnullify_path() 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 --- diff --git a/smatch_function_hooks.c b/smatch_function_hooks.c index 49035813..defd63c5 100644 --- a/smatch_function_hooks.c +++ b/smatch_function_hooks.c @@ -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);