Fixes use-after-free issue.

Calling writer() might fail in which case launch_buff gets freed.
This patch prevents the subsequent use of memory after it was freed.