From 85a623a9d42b4f50950b392973c77b94ee48fe39 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 19 Feb 2013 14:51:08 +0300 Subject: [PATCH] db: only allow functions to be saved to one function pointer In the old code, if the a function was saved to more than one function pointer then only the first was used. I've changed it to give up in that situation. Signed-off-by: Dan Carpenter --- smatch_db.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/smatch_db.c b/smatch_db.c index 9c4ad310..9da9a4a4 100644 --- a/smatch_db.c +++ b/smatch_db.c @@ -431,8 +431,14 @@ static void get_direct_callers(struct symbol *sym) } static char *ptr_name; +static int ptr_cnt; static int get_ptr_name(void *unused, int argc, char **argv, char **azColName) { + if (ptr_cnt++) { + free_string(ptr_name); + ptr_name = NULL; + return 0; + } if (!ptr_name) ptr_name = alloc_string(argv[0]); return 0; @@ -451,6 +457,7 @@ static void get_function_pointer_callers(struct symbol *sym) } ptr_name = NULL; + ptr_cnt = 0; run_sql(get_ptr_name, "select ptr from function_ptr where %s", sql_filter); if (!ptr_name) return; -- 2.11.4.GIT