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

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

 



On Wed, Aug 11, 2010 at 11:12:07PM +0200, Tobias Klauser wrote:
> realloc(NULL, size) behaves the same as malloc(size) so there is no need
> to distinguish between the two.

 Applied with a small change, thanks 

> 
> 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)

 here should be free()

>  				return -1;
>  		}

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
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