free_strict/frees_param: re-write these checks a bit
commit44f8bcddd270feddbee636ba50697fa9955e8b36
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 14 Aug 2020 13:02:13 +0000 (14 16:02 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Fri, 14 Aug 2020 13:02:13 +0000 (14 16:02 +0300)
treed9bf8d3b8ac2b0193ae7c10a0d90a152a54de810
parent659687946d46021f26d04c5216672a8ae7ac4500
free_strict/frees_param: re-write these checks a bit

The one problem is that these checks are a bit duplicative.  I maybe did
this the wrong way because I moved most of the code to the
check_free_strict and then added a hook to track that data.  Probably if
I were writing this code now, I would do it the other way around where
most of the code is in check_frees_param_strict.c and there is one hook
to handle both data base information and hard coded functions.

The other thing that I added is a "maybe_freed" state.  Because sometimes
there is a path where freed and not-freed are merged and Smatch isn't able
to separate the two paths.  In that situation, then we don't want to warn
about leaks and we don't want to warn about double frees.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
check_free_strict.c
check_frees_param.c
check_frees_param_strict.c
smatch.h