]> git.ipfire.org Git - thirdparty/git.git/commit - remote.c
remote: check config validity before creating rewrite struct
authorJeff King <peff@peff.net>
Thu, 22 Nov 2018 17:31:09 +0000 (12:31 -0500)
committerJunio C Hamano <gitster@pobox.com>
Sat, 12 Jan 2019 02:35:53 +0000 (18:35 -0800)
commit54e8c1121574fca675438ac0bbd7f6a375b92520
treed238f873bb98bce797b2950105d9cae82a39ed2b
parent98cdfbb84ad2ed6a2eb43dafa357a70a4b0a0fad
remote: check config validity before creating rewrite struct

When parsing url.foo.insteadOf, we call make_rewrite() and only then
check to make sure the config value is a string (and return an error if
it isn't). This isn't quite a leak, because the struct we allocate is
part of a global array, but it does leave a funny half-finished struct.

In practice, it doesn't make much difference because we exit soon after
due to the config error anyway. But let's flip the order here to avoid
leaving a trap for somebody in the future.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote.c