git: protect against unbalanced calls to {save,restore}_env()
commit2e1175d43d05e83fe836e1c8c8e7c25b7ee659ae
authorJunio C Hamano <gitster@pobox.com>
Wed, 27 Jan 2016 06:50:27 +0000 (26 22:50 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 Jan 2016 23:19:03 +0000 (27 15:19 -0800)
tree05ae2bd23b338bd8db109e77d600e46cce3068f9
parent9d1d2b7fad9bec6320a2058c625787c835864960
git: protect against unbalanced calls to {save,restore}_env()

We made sure that save_env_before_alias() does not skip saving the
environment when asked to (which led to use-after-free of orig_cwd
in restore_env() in the buggy version) with the previous step.

Protect against future breakage where somebody adds new callers of
these functions in an unbalanced fashion.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
git.c