Fix all detected memory leaks from PostgreSQL driver