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

Andrew Vagin avagin at gmail.com
Fri May 18 04:12:04 EDT 2012


On 05/18/2012 11:08 AM, Cyrill Gorcunov wrote:
> 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.
Yep. Thanks.
>> +		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