patterndb: Fix test_patterndb crash when testing outside-of-rule db look...

...ups.

First test_patterndb_tags_outside_of_rule() nulls out the messages pointer,
then it calls clean_pattern_db(), which unconditionally dereferences it.

This will never work.

Guard the use of messages in clean_pattern_db() with a nullity check.

Signed-off-by: Nick Alcock <nix@esperi.org.uk>