* [PATCH] libvchan: Fix cleanup when xc_gntshr_open failed
@ 2017-07-26 21:27 Marek Marczykowski-Górecki
2017-07-28 14:57 ` Wei Liu
0 siblings, 1 reply; 2+ messages in thread
From: Marek Marczykowski-Górecki @ 2017-07-26 21:27 UTC (permalink / raw)
To: xen-devel; +Cc: Wei Liu, Ian Jackson, Marek Marczykowski-Górecki
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 <marmarek@invisiblethingslab.com>
---
tools/libvchan/init.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/libvchan/init.c b/tools/libvchan/init.c
index 83e1dee..e53f3a7 100644
--- a/tools/libvchan/init.c
+++ b/tools/libvchan/init.c
@@ -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;
--
2.7.5
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] libvchan: Fix cleanup when xc_gntshr_open failed
2017-07-26 21:27 [PATCH] libvchan: Fix cleanup when xc_gntshr_open failed Marek Marczykowski-Górecki
@ 2017-07-28 14:57 ` Wei Liu
0 siblings, 0 replies; 2+ messages in thread
From: Wei Liu @ 2017-07-28 14:57 UTC (permalink / raw)
To: Marek Marczykowski-Górecki; +Cc: Wei Liu, Ian Jackson, xen-devel
On Wed, Jul 26, 2017 at 11:27:14PM +0200, Marek Marczykowski-Górecki wrote:
> 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 <marmarek@invisiblethingslab.com>
Not a big fan of mixing error handling style but seeing the code is
already like that:
Acked-by: Wei Liu <wei.liu2@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-28 14:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-26 21:27 [PATCH] libvchan: Fix cleanup when xc_gntshr_open failed Marek Marczykowski-Górecki
2017-07-28 14:57 ` Wei Liu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.