do not free object used by head while it can be used - stagit-gopher - static git page generator for gopher
HTML git clone git://git.codemadness.org/stagit-gopher
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 5efa97660121c70c81041935244d8a7e02eaa3e6
DIR parent 177daf1c791efdac437ce88826f97aab24cea17a
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 13 Sep 2026 12:12:59 +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-gopher.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
---
DIR diff --git a/stagit-gopher.c b/stagit-gopher.c
@@ -1327,8 +1327,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, '/')))