[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] libs/devicemodel: free xencall handle in error path in _open()
> -----Original Message----- > From: Wei Liu [mailto:wei.liu2@xxxxxxxxxx] > Sent: 27 February 2017 12:20 > To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx> > Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxx>; Paul Durrant > <Paul.Durrant@xxxxxxxxxx>; Wei Liu <wei.liu2@xxxxxxxxxx> > Subject: [PATCH] libs/devicemodel: free xencall handle in error path in > _open() > > Change the allocation to use calloc to get zeroed structure. Free > xencall handler in error path. > > Spotted by Coverity. > > Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Reviewed-by: Paul Durrant <paul.durrant@xxxxxxxxxx> > --- > tools/libs/devicemodel/core.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c > index 19ebef63b3..a85cb49c22 100644 > --- a/tools/libs/devicemodel/core.c > +++ b/tools/libs/devicemodel/core.c > @@ -24,7 +24,7 @@ > xendevicemodel_handle *xendevicemodel_open(xentoollog_logger > *logger, > unsigned open_flags) > { > - xendevicemodel_handle *dmod = malloc(sizeof(*dmod)); > + xendevicemodel_handle *dmod = calloc(1, sizeof(*dmod)); > int rc; > > if (!dmod) > @@ -54,6 +54,7 @@ xendevicemodel_handle > *xendevicemodel_open(xentoollog_logger *logger, > > err: > xtl_logger_destroy(dmod->logger_tofree); > + xencall_close(dmod->xcall); > free(dmod); > return NULL; > } > -- > 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |