config: fix leak in git_config_get_expiry_in_days()
authorJeff King <redacted>
Mon, 17 Aug 2020 21:33:13 +0000 (17:33 -0400)
committerJunio C Hamano <redacted>
Mon, 17 Aug 2020 22:35:47 +0000 (15:35 -0700)
commit1c890016a147536e4a6faa5664eedd8765a01b32
tree7f6de87f5e77b296462cb526c3ef23972a243da7
parent9a53219f69bd470053cf93c3f4d2a77b6d4df3e5
config: fix leak in git_config_get_expiry_in_days()

We use git_config_get_string() to retrieve the expiry value in a newly
allocated string. But after parsing it, we never free it, leaking the
memory.

We could fix this with a free() obviously, but there's an even better
solution: we can use the non-allocating "tmp" variant of the function;
we only need it to be valid for the lifetime of our parse function.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
config.c
git clone https://git.99rst.org/PROJECT