From: Ludovic Rousseau Date: Mon, 21 Jun 2010 08:19:29 +0000 (+0200) Subject: Only initialize the default context when it is requested X-Git-Tag: upstream/1.0.21~914 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=139648d5723190734a51c1c66ddf41c3e87adf10;p=platform%2Fupstream%2Flibusb.git Only initialize the default context when it is requested --- diff --git a/libusb/core.c b/libusb/core.c index f16a05a..ac10266 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -1532,15 +1532,15 @@ API_EXPORTED int libusb_init(libusb_context **context) goto err_destroy_mutex; } - if (!usbi_default_context) { + if (context) { + *context = ctx; + } else if (!usbi_default_context) { usbi_dbg("created default context"); usbi_default_context = ctx; default_context_refcnt++; } usbi_mutex_static_unlock(&default_context_lock); - if (context) - *context = ctx; return 0; err_destroy_mutex: