Fix a usbi_pollfd leak in error path
authorDaniel Drake <dan@reactivated.net>
Wed, 19 May 2010 20:37:29 +0000 (17:37 -0300)
committerDaniel Drake <dan@reactivated.net>
Wed, 19 May 2010 20:37:29 +0000 (17:37 -0300)
I accidently missed this when applying Pete Batard's earlier patch.
Pointed out by Michael Plante.

libusb/io.c

index 6ea816c..c7bfeb5 100644 (file)
@@ -1031,6 +1031,7 @@ int usbi_io_init(struct libusb_context *ctx)
                usbi_dbg("using timerfd for timeouts");
                r = usbi_add_pollfd(ctx, ctx->timerfd, POLLIN);
                if (r < 0) {
+                       usbi_remove_pollfd(ctx, ctx->ctrl_pipe[0]);
                        close(ctx->timerfd);
                        goto err_close_pipe;
                }