Fix some memory leaks on PostgreSQL driver