vcomp/cmpto_j2k: free state if no tech

clean up if failed to set technology (default or user-specified)

If failed print the reason in get_default_technology() not _init()
(it is also so in get_technology()).
This commit is contained in:
Martin Pulec
2025-05-26 13:02:58 +02:00
parent 159ce3f8ae
commit 1d5d55c484

View File

@@ -171,6 +171,7 @@ get_default_technology()
{
const struct cmpto_version *version = cmpto_j2k_enc_get_version();
if (version == nullptr) {
MSG(ERROR, "Cannot get Cmpto J2K supported technologies!\n");
return nullptr;
}
if ((version->technology & CMPTO_TECHNOLOGY_CUDA) != 0) {
@@ -179,6 +180,7 @@ get_default_technology()
if ((version->technology & CMPTO_TECHNOLOGY_CPU) != 0) {
return &technology_cpu;
}
MSG(ERROR, "No supported technology (CUDA or CPU)!\n");
return nullptr;
}
@@ -691,7 +693,7 @@ static struct module * j2k_compress_init(struct module *parent, const char *c_cf
}
if (s->tech == nullptr) {
MSG(ERROR, "No supported technology!\n");
j2k_compress_done((struct module *) s);
return nullptr;
}
MSG(INFO, "Using technology: %s\n", s->tech->name);