]> git.ipfire.org Git - thirdparty/git.git/commit
object-file-convert: don't leak when converting tag objects
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 2 Oct 2023 02:40:21 +0000 (21:40 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Oct 2023 21:57:39 +0000 (14:57 -0700)
commitac45d995f3329e5a7e85bf103bd94b48107b3803
tree608e333533654e38717c41de52b4b7d831f53360
parentc8762c30df5b5c0a2a91e14e77cfc94b459d089b
object-file-convert: don't leak when converting tag objects

Upon close examination I discovered that while brian's code to convert
tag objects was functionally correct, it leaked memory.

Rearrange the code so that all error checking happens before any
memory is allocated.

Add code to release the temporary strbufs the code uses.

The code pretty much assumes the tag object ends with a newline,
so add an explict test to verify that is the case.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
object-file-convert.c