Commit c700d1fe authored by Andy Polyakov's avatar Andy Polyakov
Browse files

asn1/tasn_utl.c: fix logical error in asn1_do_lock.



CRYPTO_atomic_add was assumed to return negative value on error, while
it returns 0.

Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
Reviewed-by: default avatarPaul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/6843)
parent 4e7ade96
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it)
        }
        return 1;
    }
    if (CRYPTO_atomic_add(lck, op, &ret, *lock) < 0)
    if (!CRYPTO_atomic_add(lck, op, &ret, *lock))
        return -1;  /* failed */
#ifdef REF_PRINT
    fprintf(stderr, "%p:%4d:%s\n", it, *lck, it->sname);