Fix memory leak
Output buffer was allocated, but never freed