[xen master] libvchan: Fix cleanup when xc_gntshr_open failed

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[xen master] libvchan: Fix cleanup when xc_gntshr_open failed

patchbot
commit a3a87d27a3de57ab5591d5d2604e6a5c6c806eab
Author:     Marek Marczykowski-Górecki <[hidden email]>
AuthorDate: Wed Jul 26 23:27:14 2017 +0200
Commit:     Wei Liu <[hidden email]>
CommitDate: Fri Jul 28 17:46:14 2017 +0100

    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 <[hidden email]>
    Acked-by: Wei Liu <[hidden email]>
---
 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;
--
generated by git-patchbot for /home/xen/git/xen.git#master


_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog
Loading...