Commit 21e0fc32abe6e73a5efc5c4401da69e2c133b099

Carlos Martín Nieto 2016-11-14T17:55:49

Plug a leak in the refs compressor

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/src/refdb_fs.c b/src/refdb_fs.c
index 7601aa0..558d060 100644
--- a/src/refdb_fs.c
+++ b/src/refdb_fs.c
@@ -927,6 +927,7 @@ static int packed_remove_loose(refdb_fs_backend *backend)
 			continue;
 
 		if (error < 0) {
+			git_buf_free(&ref_content);
 			giterr_set(GITERR_REFERENCE, "failed to lock loose reference '%s'", ref->name);
 			return error;
 		}
@@ -957,6 +958,7 @@ static int packed_remove_loose(refdb_fs_backend *backend)
 		p_unlink(lock.path_original);
 	}
 
+	git_buf_free(&ref_content);
 	git_filebuf_cleanup(&lock);
 	return 0;
 }