From: Juergen Gross Date: Mon, 18 Jan 2016 08:03:56 +0000 (+0100) Subject: xenstore: destroy xenstore domain in case of error after creating it X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~1941 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=80a6904bdb8644c17963e709d6093190511127ac;p=xen.git xenstore: destroy xenstore domain in case of error after creating it When creating a xenstore domain via init-xenstore-domain destroy it in case of an error occurred after calling xc_domain_create(). Signed-off-by: Juergen Gross Acked-by: Daniel De Graaf Acked-by: Ian Campbell --- diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c index 9c47af1ba6..a9c5821be4 100644 --- a/tools/helpers/init-xenstore-domain.c +++ b/tools/helpers/init-xenstore-domain.c @@ -11,7 +11,7 @@ #include #include -static uint32_t domid = -1; +static uint32_t domid = ~0; static int build(xc_interface *xch, int argc, char** argv) { @@ -94,6 +94,8 @@ static int build(xc_interface *xch, int argc, char** argv) err: if ( dom ) xc_dom_release(dom); + if ( domid != ~0 ) + xc_domain_destroy(xch, domid); close(xs_fd); return rv; }