diff options
author | Chris Dickens <christopher.a.dickens@gmail.com> | 2014-08-26 23:36:13 -0700 |
---|---|---|
committer | Chris Dickens <chris.dickens@hp.com> | 2014-08-29 15:58:17 -0700 |
commit | 47e1141f6b064a99fad7956b9b00b335bd90476d (patch) | |
tree | f86501b5d9e41b00f92a0befd5566d3659204a64 | |
parent | 3c323dc36e0d7c77dba4c189c1815bf0f7e616bb (diff) | |
download | libusb-47e1141f6b064a99fad7956b9b00b335bd90476d.tar.gz |
core: Fix reference count leak for default context
If the default context was created but failed to fully initialize,
the reference count was not decremented appropriately.
-rw-r--r-- | libusb/core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libusb/core.c b/libusb/core.c index 1b74493..4561740 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -1948,8 +1948,10 @@ err_backend_exit: if (usbi_backend->exit) usbi_backend->exit(); err_free_ctx: - if (ctx == usbi_default_context) + if (ctx == usbi_default_context) { usbi_default_context = NULL; + default_context_refcnt--; + } usbi_mutex_static_lock(&active_contexts_lock); list_del (&ctx->list); |