Avoid safe_free() usage and add security checks
Add checks to check_sec.sh for memory functions.
These include a check for use of safe_free() instead of FREE() and a
check whether FREE(&...) is used.
For the former, SAFE_FREE_CHECKED is to be used, for the latter
FREE_CHECKED to avoid messages from check_sec.sh