If the first serializer we find is the desired one that's ok
Stop looking for a desired serializer if the first one is desired.
@@ -121,13 +121,13 @@ static void select_serializer(const char *name, void *data)
return;
if ((s = OSSL_SERIALIZER_fetch(d->libctx, name, d->propquery)) != NULL) {
- if (d->first == NULL && s->serialize_data != NULL) {
- d->first = s;
- } else if (OSSL_SERIALIZER_provider(s) == d->desired_provider
+ if (OSSL_SERIALIZER_provider(s) == d->desired_provider
&& s->serialize_object != NULL) {
OSSL_SERIALIZER_free(d->first);
d->first = NULL;
d->desired = s;
+ } else if (d->first == NULL && s->serialize_data != NULL) {
+ d->first = s;
} else {
OSSL_SERIALIZER_free(s);
}
