From: Lasya Subject: [PATCH] 'dom' error handled, by raising ENOMEM if failure occurs. 'xs_fd' leak handled in success path. Date: Wed, 28 Oct 2015 03:49:33 +0530 Message-ID: <1445984373-8087-1-git-send-email-comethalley61@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Zr1MS-0000Gn-SV for xen-devel@lists.xenproject.org; Tue, 27 Oct 2015 10:20:12 +0000 Received: by padhk11 with SMTP id hk11so218971538pad.1 for ; Tue, 27 Oct 2015 03:20:05 -0700 (PDT) List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org, george.dunlap@citrix.com, lars.kurth@citrix.com, wei.liu2@citrix.com, dario.faggioli@citrix.com, ian.campbell@citrix.com Cc: Lasya List-Id: xen-devel@lists.xenproject.org Signed-off-by: Lasya Venneti --- tools/xenstore/init-xenstore-domain.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/xenstore/init-xenstore-domain.c b/tools/xenstore/init-xenstore-domain.c index 0d12169..b413b09 100644 --- a/tools/xenstore/init-xenstore-domain.c +++ b/tools/xenstore/init-xenstore-domain.c @@ -42,6 +42,10 @@ static int build(xc_interface *xch, int argc, char** argv) snprintf(cmdline, 512, "--event %d --internal-db", rv); dom = xc_dom_allocate(xch, cmdline, NULL); + if(dom==NULL) { + rv=ENOMEM; + goto err; + } rv = xc_dom_kernel_file(dom, argv[1]); if (rv) goto err; @@ -70,7 +74,8 @@ static int build(xc_interface *xch, int argc, char** argv) if (rv) goto err; rv = xc_domain_unpause(xch, domid); if (rv) goto err; - + + close(xs_fd); return 0; err: -- 1.9.1