Fix possible leaks