[CRIU] Re: [PATCH 1/8] protobuf: Convert struct pipe_data_entry to PB engine

Pavel Emelyanov xemul at parallels.com
Tue Jul 17 06:23:01 EDT 2012


On 07/17/2012 01:51 PM, Cyrill Gorcunov wrote:
> On Tue, Jul 17, 2012 at 01:49:21PM +0400, Pavel Emelyanov wrote:
>>> @@ -76,11 +77,8 @@ int collect_pipe_data(int img_type, struct pipe_data_rst **hash)
>>>  		r = xmalloc(sizeof(*r));
>>>  		if (!r)
>>>  			break;
>>> -		r->pde = xmalloc(sizeof(*r->pde));
>>> -		if (!r->pde)
>>> -			break;
>>>  
>>> -		ret = read_img_eof(fd, r->pde);
>>> +		ret = pb_read_eof(fd, &r->pde, pipe_data_entry);
>>>  		if (ret <= 0)
>>>  			break;
>> There will be a xfree(r->pde) on EOF. Why doesn't it crash?
> 
> it'll be xfree(NULL) then (since pb_read sets r->pde = NULL).

If pipe_data_read fails this will be non NULL :\

> 	Cyrill
> .
> 



More information about the CRIU mailing list