]> git.99rst.org Git - git.git/commit
object-file: fix memory leak in `force_object_loose()`
authorPatrick Steinhardt <redacted>
Fri, 17 Jul 2026 09:32:14 +0000 (11:32 +0200)
committerJunio C Hamano <redacted>
Sun, 19 Jul 2026 02:03:48 +0000 (19:03 -0700)
commit0e002f6dc74841324687284e6a3ae4a6061c0c73
tree86be50f6e64b9b9569234ba6db9400984045ce24
parent8d9135dce3be50c961f23f5e89352b0fd1d61117
object-file: fix memory leak in `force_object_loose()`

We return an error when converting the given object to the compatibility
hash algorithm fails. This early return causes a memory leak though,
because we don't free the content buffer that we've already read before
via `odb_read_object_info_extended()`.

Plug the memory leak by creating a common exit path where the buffer
gets free'd.

Signed-off-by: Patrick Steinhardt <redacted>
Signed-off-by: Junio C Hamano <redacted>
object-file.c
git clone https://git.99rst.org/PROJECT