[CRIU] [PATCH cr 5/6] pstree: allocate rst parts from a shared
region
Cyrill Gorcunov
gorcunov at openvz.org
Tue Oct 2 13:06:27 EDT 2012
On Tue, Oct 02, 2012 at 06:07:21PM +0400, Andrey Vagin wrote:
> @@ -33,10 +33,16 @@ struct pstree_item *__alloc_pstree_item(bool rst)
> {
> struct pstree_item *item;
>
> - item = xzalloc(sizeof(*item) + (rst ? sizeof(item->rst[0]) : 0));
> + item = xzalloc(sizeof(*item));
> if (!item)
> return NULL;
>
> + if (rst) {
> + item->rst = shmalloc(sizeof(item->rst[0]));
> + if (!item->rst)
xfree(item);
> + return NULL;
> + }
> +
> INIT_LIST_HEAD(&item->children);
> item->threads = NULL;
> item->nr_threads = 0;
Cyrill
More information about the CRIU
mailing list