* sorted and sorting the would result in O(n^2 log n) complexity.
*/
if (k > 0) {
- X509_STORE_lock(xl->store_ctx);
+ if (!X509_STORE_lock(xl->store_ctx))
+ goto finish;
j = sk_X509_OBJECT_find(xl->store_ctx->objs, &stmp);
tmp = sk_X509_OBJECT_value(xl->store_ctx->objs, j);
X509_STORE_unlock(xl->store_ctx);
finish:
/* If we changed anything, resort the objects for faster lookup */
if (!sk_X509_OBJECT_is_sorted(xl->store_ctx->objs)) {
- X509_STORE_lock(xl->store_ctx);
- sk_X509_OBJECT_sort(xl->store_ctx->objs);
- X509_STORE_unlock(xl->store_ctx);
+ if (X509_STORE_lock(xl->store_ctx)) {
+ sk_X509_OBJECT_sort(xl->store_ctx->objs);
+ X509_STORE_unlock(xl->store_ctx);
+ }
}
BUF_MEM_free(b);