[CRIU] Re: [PATCH cr] crtools: link pstree_item-s in a tree

Cyrill Gorcunov gorcunov at openvz.org
Fri May 18 03:08:42 EDT 2012


On Fri, May 18, 2012 at 10:08:52AM +0400, Andrey Vagin wrote:
>  static int get_children(struct pstree_item *item)
>  {
> -	return parse_children(item, &item->children, &item->nr_children);
> +	u32 *ch;
> +	int ret, i, nr_children;
> +	struct pstree_item *c;
> +
> +	ret = parse_children(item, &ch, &nr_children);
> +	if (ret < 0)
> +		return ret;
> +
> +	for (i = 0; i < nr_children; i++) {
> +		c = alloc_pstree_item();

Please Andrey, make sure you _are_ testing alloc_pstree_item()
for NULL return.

> +		c->pid = ch[i];
> +		c->parent = item;
> +		list_add_tail(&c->list, &item->children);
> +	}
> +
> +	xfree(ch);
> +	return ret;
>  }

	Cyrill


More information about the CRIU mailing list