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

Pavel Emelyanov xemul at parallels.com
Tue Jul 17 05:49:21 EDT 2012


On 07/17/2012 12:52 PM, Cyrill Gorcunov wrote:
> 
> Note, at moment we don't use "data" from proto declaration,
> it's reserved to implement later (simply because it's easier
> to use current code for a while).
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  cr-show.c                |   10 ++++++----
>  include/image.h          |    6 ------
>  include/pipes.h          |    5 ++++-
>  pipes.c                  |   10 ++++------
>  protobuf/Makefile        |    1 +
>  protobuf/pipe-data.proto |    4 ++++
>  6 files changed, 19 insertions(+), 17 deletions(-)
>  create mode 100644 protobuf/pipe-data.proto
> 

> @@ -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?


More information about the CRIU mailing list