From 94675b2dac5d09d1418a1e2fc448fd42473f3bc8 Mon Sep 17 00:00:00 2001 From: Anshul Maheshwari Date: Fri, 9 Jan 2015 13:14:32 +0100 Subject: [PATCH] handle no language found --- src/lib_ccx/dvb_subtitle_decoder.c | 5 +++++ src/lib_ccx/ocr.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) 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) {