diff --git a/src/lib_ccx/dvb_subtitle_decoder.c b/src/lib_ccx/dvb_subtitle_decoder.c index 859c6f31..29eb3607 100644 --- a/src/lib_ccx/dvb_subtitle_decoder.c +++ b/src/lib_ccx/dvb_subtitle_decoder.c @@ -435,6 +435,11 @@ void* dvbsub_init_decoder(struct dvb_config* cfg) #ifdef ENABLE_OCR ctx->ocr_ctx = init_ocr(ctx->lang_index); + if(!ctx->ocr_ctx) + { + freep(&ctx); + return NULL; + } #endif ctx->version = -1; diff --git a/src/lib_ccx/ocr.c b/src/lib_ccx/ocr.c index 3f9c4466..2de8c664 100644 --- a/src/lib_ccx/ocr.c +++ b/src/lib_ccx/ocr.c @@ -67,7 +67,7 @@ static void delete_ocr (struct ocrCtx* ctx) { TessBaseAPIEnd(ctx->api); TessBaseAPIDelete(ctx->api); - freep(ctx); + freep(&ctx); } void* init_ocr(int lang_index) {