[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] libxc: memory leak in handle_hvm_context
There is no memory leak in case when handle_hvm_context function is called next time. So the code seems ok, please ignore the mail, sorry for confusion. Thanks On Fri, May 17, 2019 at 2:49 PM Viktor Mitin <viktor.mitin.19@xxxxxxxxx> wrote: > > Hi All, > > It seems there is a memory leak in libxc function handle_hvm_context > (in file tools/libxc/xc_sr_restore_x86_hvm.c.). There is a malloc of > variable p without free. > Please take a look. > > +/* > + * Process an HVM_CONTEXT record from the stream. > + */ > +static int handle_hvm_context(struct xc_sr_context *ctx, > + struct xc_sr_record *rec) > +{ > + xc_interface *xch = ctx->xch; > + void *p; > + > + p = malloc(rec->length); > + if ( !p ) > + { > + ERROR("Unable to allocate %u bytes for hvm context", rec->length); > + return -1; > + } > + > + free(ctx->x86_hvm.restore.context); > + > + ctx->x86_hvm.restore.context = memcpy(p, rec->data, rec->length); > + ctx->x86_hvm.restore.contextsz = rec->length; > + > + return 0; > +} > > Thanks _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |