fish-shell/fish-shell — pull request #1455 by daniel-j-h (2014-05-10 14:11:54+00:00)
Title: Fixes use-after-free issue in mimedb.cpp

Calling writer() might fail in which case launch_buff gets freed.

In detail: the realloc in writer() might return null, in which case the launch_buff gets freed and an error is set appropriately. But on the call site launch_buf was still passed to system().

So either we set launch_buff to null or avoid the invalid memory access.

This patch prevents the subsequent use of memory after it was freed.