From 0f13ea2a845a03c2b5f1c018a8521f959de03cc1 Mon Sep 17 00:00:00 2001 From: Alexander Tereshkin Date: Sat, 12 May 2012 18:32:36 +0400 Subject: [PATCH] Fixed a potential memory leak. --- vchan/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vchan/init.c b/vchan/init.c index 90e1e21a..58ddffd7 100644 --- a/vchan/init.c +++ b/vchan/init.c @@ -264,9 +264,9 @@ static int client_interface_init(struct libvchan *ctrl, int domain, int devno) if (!ref) goto fail; ctrl->ring_ref = atoi(ref); + free(ref); if (!ctrl->ring_ref) goto fail; - free(ref); snprintf(buf, sizeof buf, "/local/domain/%d/device/vchan/%d/event-channel", domain, devno); @@ -274,9 +274,9 @@ static int client_interface_init(struct libvchan *ctrl, int domain, int devno) if (!ref) goto fail; remote_port = atoi(ref); + free(ref); if (!remote_port) goto fail; - free(ref); #ifdef XENCTRL_HAS_XC_INTERFACE xcfd = xc_interface_open(NULL, NULL, 0); if (!xcfd)