Re: [PATCH 1/3] column: use xalloc libs

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

 



On Tue, 2011-12-20 at 08:36 -0500, Dave Reisner wrote:
> Signed-off-by: Dave Reisner <dreisner@xxxxxxxxxxxxx>
> ---
>  text-utils/column.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/text-utils/column.c b/text-utils/column.c
> index 79d2842..c642680 100644
> --- a/text-utils/column.c
> +++ b/text-utils/column.c
> @@ -395,7 +395,7 @@ static wchar_t *mbs_to_wcs(const char *s)
>  	n = mbstowcs((wchar_t *)0, s, 0);
>  	if (n < 0)
>  		return NULL;
> -	wcs = malloc((n + 1) * sizeof(wchar_t));
> +	wcs = xmalloc((n + 1) * sizeof(wchar_t));
>  	if (!wcs)
>  		return NULL;

Hmm this isn't that straight forward, if the memory allocation fails
here we don't necessarily abort the program.

>  	n = mbstowcs(wcs, s, n + 1);


--
To unsubscribe from this list: send the line "unsubscribe util-linux" 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