Fix memory leak when doing base64 conversion.