[PATCH] losetup: Do not distinguish between malloc and realloc

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

 



realloc(NULL, size) behaves the same as malloc(size) so there is no need
to distinguish between the two.

Signed-off-by: Tobias Klauser <tklauser@xxxxxxxxxx>
---
 mount/lomount.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/mount/lomount.c b/mount/lomount.c
index 54b9f8e..4cbc3bf 100644
--- a/mount/lomount.c
+++ b/mount/lomount.c
@@ -259,8 +259,7 @@ loop_scandir(const char *dirname, int **ary, int hasprefix)
 			continue;
 		if (count + 1 > arylen) {
 			arylen += 1;
-			*ary = *ary ? realloc(*ary, arylen * sizeof(int)) :
-				      malloc(arylen * sizeof(int));
+			*ary = realloc(*ary, arylen * sizeof(int));
 			if (!*ary)
 				return -1;
 		}
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux