|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH V2 1/2] libxl: Have flexarray using the GC
Anthony PERARD writes ("[PATCH V2 1/2] libxl: Have flexarray using the GC"):
> This patch makes the flexarray function libxl__gc aware.
> +/*
> + * It is safe to store gc in the struct because:
> + * - If it an actual gc, then the flexarray should not be used after the gc
> + * have been freed.
> + * - If it is a NOGC, then this point to a structure embedded in libxl_ctx,
> + * therefore will survive across several libxl calls.
> + */
Thanks, I think this explanation is correct.
> +static int gc_is_real(const libxl__gc *gc)
> +{
> + return gc->alloc_maxsize >= 0;
> +}
You have cloned-and-hacked this from libxl_internal.c ! Instead,
either declare it in libxl_internal.h, or move it there and make it
"static inline".
> @@ -104,7 +115,8 @@ void **flexarray_contents(flexarray_t *array)
> {
> void **data;
> data = array->data;
> - free(array);
> + if (!gc_is_real(array->gc))
> + free(array);
> return data;
What an odd function. However, your patch to it seems right to me.
> diff --git a/tools/libxl/flexarray.h b/tools/libxl/flexarray.h
> index ae17f3b..aade417 100644
And the rest of the patch is mostly an impressive number of
deletions. I won't check the semantics of each one but the style
seems plausible.
Thanks!
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |