"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
plug memory leak in got_ref_list_free()
To:
gameoftrees@openbsd.org
Date:
Thu, 20 May 2021 12:11:23 +0200

Download raw body.

Thread
Code which inserts a reference into a reflist passes ownership of
this reference to the list. However, got_ref_list_free() never
frees such references, which results in a memory leak.

ok?

diff 9069347b693ed2803ca224d77823b2e4e2f2e4e5 /home/stsp/src/got
blob - 4b530db4089bee13c3808f740ec124254aa41fca
file + lib/reference.c
--- lib/reference.c
+++ lib/reference.c
@@ -1060,6 +1060,7 @@ got_ref_list_free(struct got_reflist_head *refs)
 
 	while ((re = TAILQ_FIRST(refs))) {
 		TAILQ_REMOVE(refs, re, entry);
+		got_ref_close(re->ref);
 		free(re);
 	}