When we encounter a failure, all previously borrowed references should be freed. Especially if the program is not failing immediately This patch must be backported as far as 2.0.