Fix Valgrind errors

Fixes libattachsql/libattachsql#109