summaryrefslogtreecommitdiffstats
path: root/object-name.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-08-14 08:52:00 +0200
committerJunio C Hamano <gitster@pobox.com>2024-08-14 19:07:57 +0200
commit9ddd5f755d78dd2a3119b63d5f78ca93e4fd3eba (patch)
tree725b5cc5d4548a6b251771eeea06fb87be24e1c9 /object-name.c
parentobject-file: fix memory leak when reading corrupted headers (diff)
downloadgit-9ddd5f755d78dd2a3119b63d5f78ca93e4fd3eba.tar.xz
git-9ddd5f755d78dd2a3119b63d5f78ca93e4fd3eba.zip
object-name: fix leaking symlink paths in object context
The object context may be populated with symlink contents when reading a symlink, but the associated strbuf doesn't ever get released when releasing the object context, causing a memory leak. Plug it. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object-name.c')
-rw-r--r--object-name.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/object-name.c b/object-name.c
index 240a93e7ce..e39fa50e47 100644
--- a/object-name.c
+++ b/object-name.c
@@ -1765,6 +1765,7 @@ int strbuf_check_branch_ref(struct strbuf *sb, const char *name)
void object_context_release(struct object_context *ctx)
{
free(ctx->path);
+ strbuf_release(&ctx->symlink_path);
}
/*