[PATCH 4] janitor: useless checks before free

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

 



Signed-off-by: Pierre Habouzit <madcoder@xxxxxxxxxx>
---

   On the same vein, a few simplifications wrt if (x) free(x)

 pack-revindex.c |    3 +--
 walker.c        |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/pack-revindex.c b/pack-revindex.c
index 1de53c8..77a0465 100644
--- a/pack-revindex.c
+++ b/pack-revindex.c
@@ -149,8 +149,7 @@ void discard_revindex(void)
 	if (pack_revindex_hashsz) {
 		int i;
 		for (i = 0; i < pack_revindex_hashsz; i++)
-			if (pack_revindex[i].revindex)
-				free(pack_revindex[i].revindex);
+			free(pack_revindex[i].revindex);
 		free(pack_revindex);
 		pack_revindex_hashsz = 0;
 	}
diff --git a/walker.c b/walker.c
index e57630e..11d9052 100644
--- a/walker.c
+++ b/walker.c
@@ -245,7 +245,7 @@ void walker_targets_free(int targets, char **target, const char **write_ref)
 {
 	while (targets--) {
 		free(target[targets]);
-		if (write_ref && write_ref[targets])
+		if (write_ref)
 			free((char *) write_ref[targets]);
 	}
 }
-- 
1.6.4.rc1.193.g47c25d

Attachment: signature.asc
Description: Digital signature


[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]