Free buf if we return early.

Issue was caught by the Xcode analyzer.