Commit bc5e881ab9b3f23c4c4d00845d2e553d4fcd7e56

Stefan Sperling 2022-03-23T20:55:26

plug a memory leak in got_fetch_pack(); patch by Mikhail

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/lib/fetch.c b/lib/fetch.c
index e557ed1..c6a947c 100644
--- a/lib/fetch.c
+++ b/lib/fetch.c
@@ -500,6 +500,8 @@ got_fetch_pack(struct got_object_id **pack_hash, struct got_pathlist_head *refs,
 		err = got_error_from_errno("asprintf");
 		goto done;
 	}
+	free(id_str);
+	id_str = NULL;
 
 	if (rename(tmppackpath, packpath) == -1) {
 		err = got_error_from_errno3("rename", tmppackpath, packpath);
@@ -534,6 +536,7 @@ done:
 	free(tmppackpath);
 	free(tmpidxpath);
 	free(idxpath);
+	free(id_str);
 	free(packpath);
 	free(progress);