libvchan: Fix cleanup when xc_gntshr_open failed
PATCH 1/1 libvchan: Fix cleanup when xc_gntshr_open failed
If xc_gntshr_open failed the only thing to cleanup is free allocated memory. So instead of calling libxenvchan_close (which assume valid calculated buffers being mmaped already) free memory and return.
Signed-off-by Marek Marczykowski-Górecki <[email protected]>
--- tools/libvchan/init.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/libvchan/init.c +4 -2
@@ -329,8 +329,10 @@ struct libxenvchan *libxenvchan_server_init(struct xentoollog_logger *logger, } ctrl->gntshr =xengntshr_open (logger,0 ); -if (!ctrl->gntshr) - goto out; +if (!ctrl->gntshr) { +free (ctrl); +return 0 ; + }if (init_evt_srv (ctrl, domain, logger)) goto out;
Signature · 7 lines
2.7.5 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 5 lines · Marek Marczykowski-Górecki
If
xc_gntshr_openfailed the only thing to cleanup is free allocated memory. So instead of callinglibxenvchan_close(which assume valid calculated buffers being mmaped already) free memory and return.Signed-off-by Marek Marczykowski-Górecki <[email protected]>
Not a big fan of mixing error handling style but seeing the code is already like that:
Acked-by Wei Liu <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel