Skip to contentSkip to conversation

test_bitmap_walk: free bitmap with bitmap_free

PATCH In review Jeff King 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore

Jeff King

author
#0 lore raw

PATCH 1/1 test_bitmap_walk: free bitmap with bitmap_free

Commit f86a374 (pack-bitmap.c: fix a memleak, 2015-03-30) noticed that we leak the "result" bitmap. But we should use "bitmap_free" rather than straight "free", as the former remembers to free the bitmap array pointed to by the struct.

---
Sorry, I should have noticed this when reviewing the original.

 pack-bitmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pack-bitmap.c +1 -1
index 62a98cc..d64bd94 100644
@@ -987,7 +987,7 @@ void test_bitmap_walk(struct rev_info *revs)
 	else
 		fprintf(stderr, "Mismatch!\n");
 
-	free(result);
+	bitmap_free(result);
 }
 
 static int rebuild_bitmap(uint32_t *reposition,
Signature · 1 line
2.4.1.528.g00591e3
#1 lore raw
Quoted 8 lines · Jeff King

Commit f86a374 (pack-bitmap.c: fix a memleak, 2015-03-30) noticed that we leak the "result" bitmap. But we should use "bitmap_free" rather than straight "free", as the former remembers to free the bitmap array pointed to by the struct.

---
Sorry, I should have noticed this when reviewing the original.

No need to be sorry, me too.
This looks good to me.

Quoted 19 lines
 pack-bitmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pack-bitmap.c +1 -2
index 62a98cc..d64bd94 100644
@@ -987,7 +987,7 @@ void test_bitmap_walk(struct rev_info *revs)
        else
                fprintf(stderr, "Mismatch!\n");
 
-       free(result);
+       bitmap_free(result);
 }
 
 static int rebuild_bitmap(uint32_t *reposition,
--

2.4.1.528.g00591e3