Prevent memory leak on error.

Reported by Klocwork #36
1 file changed