[CRIU] Re: [PATCH 1/8] protobuf: Convert struct pipe_data_entry to
PB engine
Cyrill Gorcunov
gorcunov at openvz.org
Tue Jul 17 05:51:52 EDT 2012
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).
Cyrill
More information about the CRIU
mailing list