Fix memory leak

Fixed: When no progress callback is used, the allocated error is never freed.