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

Re: [Xen-devel] [PATCH v2 02/10] libxl: turn two malloc's to libxl__malloc



Wei Liu writes ("[PATCH v2 02/10] libxl: turn two malloc's to libxl__malloc"):
> One is to combine malloc + libxl__alloc_failed. The other is to avoid
> dereferencing NULL pointer in case of malloc failure.

The former fix is simply corredt.

> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> index ad434f0..0cc73be 100644
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
> @@ -1010,7 +1010,7 @@ static int libxl__write_stub_dmargs(libxl__gc *gc,
>          i++;
>      }
>      dmargs_size++;
> -    dmargs = (char *) malloc(dmargs_size);
> +    dmargs = (char *) libxl__malloc(NOGC, dmargs_size);

This latter should IMO be fixed by using the gc, as well.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.