Recently Written · git

sacc

Mirror of git://bitreich.org/sacc, the sacc gopher client from bitreich.org.

git clone https://github.com/equwal/sacc

Log | Files | Refs


commit 827820f5580b8880939337772d85e59ae87721b6
Quentin Rameau <quinq@fifth.space>
2019-10-11 17:02:19 +0200

Fix memory leak in downloaditem

Thanks to solene for spotting this!

 sacc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sacc.c b/sacc.c
index 8a00326..c658933 100644
--- a/sacc.c
+++ b/sacc.c
@@ -574,8 +574,11 @@ downloaditem(Item *item)
 	if (!download(item, dest))
 		goto cleanup;
 
-	if (!item->tag)
-		item->tag = path;
+	if (item->tag)
+		goto cleanup;
+
+	item->tag = path;
+
 	return;
 cleanup:
 	free(path);