Fixed bug #6032: Freeing SQL result sets (post patch)