do not free object used by head while it can be used - stagit - static git page generator
HTML git clone git://git.codemadness.org/stagit
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 233cfdc2806211a128e0eca868251b8a87925eca
DIR parent 18431d188a887d0589069f6bd172fe3a5b0c4b13
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 13 Sep 2026 12:08:31 +0200
do not free object used by head while it can be used
From the libgit2 git_revparse_single documentation:
"Find a single object, as specified by a revision string.
The returned object should be released with git_object_free when no longer needed."
head is used for writing the log.
For some reason this condition was only triggered recently on a specific repository.
Diffstat:
M stagit.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
---
DIR diff --git a/stagit.c b/stagit.c
@@ -1263,8 +1263,7 @@ main(int argc, char *argv[])
/* find HEAD */
if (!git_revparse_single(&obj, repo, "HEAD"))
- head = git_object_id(obj);
- git_object_free(obj);
+ head = git_object_id(obj); /* NOTE: do not git_object_free(), it is used below */
/* use directory name as name */
if ((name = strrchr(repodirabs, '/')))