MFC r263777: sh: Fix possible memory leaks and double frees with unexpected
SIGINT.