Some fixes found running tests/libtracker-sparql/tracker-batch-test on valgrind quite a few times.
tests/libtracker-sparql/tracker-batch-test