Re: Possible lock issue

Ludovic Rousseau <[email protected]>
Newsgroups gmane.comp.lib.muscle
Message-ID <CAGstE8D_=KVNrvAJay6r-Q=qEqF08rnax4y+Zw3g1F1J8Os9Bw@mail.gmail.com>
2013/12/19 Ignacio Casal <[email protected]>:
> Hey,
>
> I was having a look at the code and found out a part that would be good to
> double check. If you go to the line 657 on:
>
> http://anonscm.debian.org/viewvc/pcsclite/trunk/PCSC/src/winscard_clnt.c?revision=6734&view=markup
>
> you see that you are under a lock but you do not unlock before the goto
> error;

Exact.
But you should also read the comments in the code:

    (void)pthread_mutex_lock(&currentContextMap->mMutex);

    /* check the context is still opened */
    currentContextMap = SCardGetContext(hContext);
    if (NULL == currentContextMap)
        /* the hContext context is now invalid
         * -> another thread may have called SCardReleaseContext
         *    so the mMutex has been unlocked */
    {
        rv = SCARD_E_INVALID_HANDLE;
        goto error;
    }


I think the code is fine.

Thanks

-- 
 Dr. Ludovic Rousseau
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.