From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: [PATCH 01/29] libxl: Further fix exit paths from libxl_device_events_handler Date: Tue, 10 Feb 2015 20:09:48 +0000 Message-ID: <1423599016-32639-2-git-send-email-ian.jackson@eu.citrix.com> References: <1423599016-32639-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1423599016-32639-1-git-send-email-ian.jackson@eu.citrix.com> 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.xensource.com Cc: Ian Jackson , Euan Harris , Roger Pau Monne List-Id: xen-devel@lists.xenproject.org On the success path, do not call GC_FREE explicitly. Instead, call AO_INPROGRESS. GC_FREE will free the gc underlying the long-term ao, which is then subsequently referenced in backend_watch_callback's call to libxl__nested_ao_create. It is a miracle that this ever works at all. Also, add an `if (rc) goto out;' after the xswatch registration. After this, libxl_device_events_handler has the conventional and correct ao initiation pattern. Signed-off-by: Ian Jackson CC: Roger Pau Monne --- v2: New in this version of the series. --- tools/libxl/libxl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index b9a1941..ae0c7e1 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -4540,11 +4540,12 @@ int libxl_device_events_handler(libxl_ctx *ctx, be_path = GCSPRINTF("/local/domain/%u/backend", domid); rc = libxl__ev_xswatch_register(gc, &ddomain.watch, backend_watch_callback, be_path); + if (rc) goto out; -out: - GC_FREE; - if (rc) return AO_ABORT(rc); return AO_INPROGRESS; + +out: + return AO_ABORT(rc); } /******************************************************************************/ -- 1.7.10.4