[CRIU] [PATCH 1/9] restore: allocate pstree items from a shared pool

Cyrill Gorcunov gorcunov at gmail.com
Thu Sep 12 09:40:03 EDT 2013


On Thu, Sep 12, 2013 at 05:24:33PM +0400, Andrey Vagin wrote:
> @@ -134,7 +134,12 @@ struct pstree_item *__alloc_pstree_item(bool rst)
>  {
>  	struct pstree_item *item;
>  
> -	item = xzalloc(sizeof(*item) + (rst ? sizeof(item->rst[0]) : 0));
> +	if (!rst)
> +		item = xzalloc(sizeof(*item));
> +	else {
> +		item = shmalloc(sizeof(*item) + sizeof(item->rst[0]));

		if (item)

> +		memset(item, 0, sizeof(*item) + sizeof(item->rst[0]));
> +	}
>  	if (!item)
>  		return NULL;


More information about the CRIU mailing list