Skip to content

Commit 1d5d55c

Browse files
committed
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()).
1 parent 159ce3f commit 1d5d55c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/video_compress/cmpto_j2k.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ get_default_technology()
171171
{
172172
const struct cmpto_version *version = cmpto_j2k_enc_get_version();
173173
if (version == nullptr) {
174+
MSG(ERROR, "Cannot get Cmpto J2K supported technologies!\n");
174175
return nullptr;
175176
}
176177
if ((version->technology & CMPTO_TECHNOLOGY_CUDA) != 0) {
@@ -179,6 +180,7 @@ get_default_technology()
179180
if ((version->technology & CMPTO_TECHNOLOGY_CPU) != 0) {
180181
return &technology_cpu;
181182
}
183+
MSG(ERROR, "No supported technology (CUDA or CPU)!\n");
182184
return nullptr;
183185
}
184186

@@ -691,7 +693,7 @@ static struct module * j2k_compress_init(struct module *parent, const char *c_cf
691693
}
692694

693695
if (s->tech == nullptr) {
694-
MSG(ERROR, "No supported technology!\n");
696+
j2k_compress_done((struct module *) s);
695697
return nullptr;
696698
}
697699
MSG(INFO, "Using technology: %s\n", s->tech->name);

0 commit comments

Comments
 (0)