[PATCH v2 1/2] pack-bitmap: remove checks before bitmap_free

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Lidong Yan <502024330056@xxxxxxxxxxxxxxxx>

In pack-bitmap.c:find_boundary_objects, we build a roots_bitmap and
cascade it to cb.base. Only when cascade failed, roots_bitmap is
freed otherwise it leaks. Since cascade_pseudo_merges_1() only use
roots_bitmap as a mutable reference not takes roots_bitmap's ownership
we'd better remove `if(cascade_pseudo_merges_1)` and frees roots_bitmap
anyway.

Signed-off-by: Lidong Yan <502024330056@xxxxxxxxxxxxxxxx>
---
 pack-bitmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pack-bitmap.c b/pack-bitmap.c
index ac6d62b980c5..8727f316de92 100644
--- a/pack-bitmap.c
+++ b/pack-bitmap.c
@@ -1363,8 +1363,8 @@ static struct bitmap *find_boundary_objects(struct bitmap_index *bitmap_git,
 			bitmap_set(roots_bitmap, pos);
 		}
 
-		if (!cascade_pseudo_merges_1(bitmap_git, cb.base, roots_bitmap))
-			bitmap_free(roots_bitmap);
+		cascade_pseudo_merges_1(bitmap_git, cb.base, roots_bitmap);
+		bitmap_free(roots_bitmap);
 	}
 
 	/*
-- 
gitgitgadget





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux