Re: [Libtirpc-devel] [PATCH] __nc_error() does not check return value from malloc

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

 




On 20/11/13 11:49, Susant Sahani wrote:
> Signed-off-by: Susant Sahani <ssahani@xxxxxxxxxx>
Committed.... 

steved.

> ---
>  src/getnetconfig.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/getnetconfig.c b/src/getnetconfig.c
> index af4a484..2460a6e 100644
> --- a/src/getnetconfig.c
> +++ b/src/getnetconfig.c
> @@ -146,7 +146,8 @@ __nc_error()
>  			return (&nc_error);
>  	}
>  	if ((nc_addr = (int *)thr_getspecific(nc_key)) == NULL) {
> -		nc_addr = (int *)malloc(sizeof (int));
> +		if((nc_addr = (int *)malloc(sizeof (int))) == NULL)
> +			return (&nc_error);
>  		if (thr_setspecific(nc_key, (void *) nc_addr) != 0) {
>  			if (nc_addr)
>  				free(nc_addr);
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux