[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 12/13] libxl: don't leak buf in libxl_xen_console_read_start error handling
Matthew Daley writes ("[PATCH 12/13] libxl: don't leak buf in libxl_xen_console_read_start error handling"): > Coverity-ID: 1055889 > Signed-off-by: Matthew Daley <mattd@xxxxxxxxxxx> ... > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > index 41b8f60..4cd54a8 100644 > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -5116,6 +5116,7 @@ libxl_xen_console_reader * > cr = malloc(sizeof(libxl_xen_console_reader)); > if (!cr) { > LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "cannot malloc > libxl_xen_console_reader"); > + free(buf); > return NULL; > } In general we prefer to use the initialise everything and "goto out" style of error handling all the time. But in this case the only errors are allocation failures which we have deemed fatal: so the function should simply be changed to use libxl__zalloc, which cannot fail. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |