From 12e9e3557979af218ddb40f1e221d7fc56596fe9 Mon Sep 17 00:00:00 2001 From: Chris Dickens Date: Fri, 29 Aug 2014 16:12:55 -0700 Subject: [PATCH] io: Move timerfd close into error handling path This makes error handling consistent with other areas. This is a follow-on change to commit b72f4cf77edb1975cada8aab5ae63361c68c5992. Signed-off-by: Chris Dickens --- libusb/io.c | 9 ++++----- libusb/version_nano.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libusb/io.c b/libusb/io.c index eb6f41b..2bc122c 100644 --- a/libusb/io.c +++ b/libusb/io.c @@ -1147,10 +1147,8 @@ int usbi_io_init(struct libusb_context *ctx) if (ctx->timerfd >= 0) { usbi_dbg("using timerfd for timeouts"); r = usbi_add_pollfd(ctx, ctx->timerfd, POLLIN); - if (r < 0) { - close(ctx->timerfd); - goto err_remove_hp_pipe; - } + if (r < 0) + goto err_close_timerfd; } else { usbi_dbg("timerfd not available (code %d error %d)", ctx->timerfd, errno); ctx->timerfd = -1; @@ -1160,7 +1158,8 @@ int usbi_io_init(struct libusb_context *ctx) return 0; #ifdef USBI_TIMERFD_AVAILABLE -err_remove_hp_pipe: +err_close_timerfd: + close(ctx->timerfd); usbi_remove_pollfd(ctx, ctx->hotplug_pipe[0]); #endif err_close_hp_pipe: diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 6841c9c..4b584fa 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 10917 +#define LIBUSB_NANO 10918 -- 2.7.4