Tests validation

When compiling suricata with unittests and debug validation:
 ./configure --enable-unittests --enable-debug --enable-debug-validation
the unittests were failing.

This patchset updates the code to have unittests working with debug validation. Two type of fixes have been needed. One is to lock the flow before calling some functions. Other is to recycle packet before flow shutdown.