Avoid freeing context on error