Bug json v0

Crash fix and cleanup.

Prscript:
- PR build: https://buildbot.suricata-ids.org/builders/inliniac/builds/278
- PR pcaps: https://buildbot.suricata-ids.org/builders/inliniac-pcap/builds/196