From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: xen-devel@lists.xen.org
Cc: "Wei Liu" <wei.liu2@citrix.com>,
"Ian Jackson" <ian.jackson@eu.citrix.com>,
"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
Subject: [PATCH] libvchan: Fix cleanup when xc_gntshr_open failed
Date: Wed, 26 Jul 2017 23:27:14 +0200 [thread overview]
Message-ID: <1501104434-1693-1-git-send-email-marmarek@invisiblethingslab.com> (raw)
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
next reply other threads:[~2017-07-26 21:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-26 21:27 Marek Marczykowski-Górecki [this message]
2017-07-28 14:57 ` [PATCH] libvchan: Fix cleanup when xc_gntshr_open failed Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1501104434-1693-1-git-send-email-marmarek@invisiblethingslab.com \
--to=marmarek@invisiblethingslab.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).