Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lib_ccx/ccx_common_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ int add_cc_sub_text(struct cc_subtitle *sub, char *str, LLONG start_time,
sub->enc_type = e_type;
sub->data = strdup(str);
if (sub->data == NULL)
{
ccx_common_logging.fatal_ftn(EXIT_NOT_ENOUGH_MEMORY,
"In add_cc_sub_text: Not enough memory for subtitle data.\n");
}
sub->datatype = CC_DATATYPE_GENERIC;
sub->nb_data = str ? strlen(str) : 0;
sub->start_time = start_time;
Expand Down
4 changes: 4 additions & 0 deletions src/lib_ccx/ccx_encoders_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,10 @@ static int init_output_ctx(struct encoder_ctx *ctx, struct encoder_cfg *cfg)

char *fname0 = strdup(cfg->output_filename);
if (fname0 == NULL)
{
fatal(EXIT_NOT_ENOUGH_MEMORY,
"In init_output_ctx: Not enough memory for output filename.\n");
}
ret = init_write(&ctx->out[0], fname0, cfg->with_semaphore);
check_ret(cfg->output_filename);
ret = init_write(&ctx->out[1], create_outfilename(basefilename, "_2", extension), cfg->with_semaphore);
Expand All @@ -621,8 +623,10 @@ static int init_output_ctx(struct encoder_ctx *ctx, struct encoder_cfg *cfg)
{
char *fname = strdup(cfg->output_filename);
if (fname == NULL)
{
fatal(EXIT_NOT_ENOUGH_MEMORY,
"In init_output_ctx: Not enough memory for output filename.\n");
}
ret = init_write(ctx->out, fname, cfg->with_semaphore);
check_ret(cfg->output_filename);
}
Expand Down
4 changes: 4 additions & 0 deletions src/lib_ccx/ccx_encoders_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ void call_function_if_match(unsigned char *line, struct word_list *list, void (*

unsigned char *line_token = strdup(line);
if (line_token == NULL)
{
ccx_common_logging.fatal_ftn(EXIT_NOT_ENOUGH_MEMORY,
"In call_function_if_match: Not enough memory for line copy.\n");
}
unsigned char *c = strtok(line_token, delim);

if (c != NULL)
Expand Down Expand Up @@ -131,8 +133,10 @@ void telx_correct_case(char *sub_line)

char *line = strdup(((char *)sub_line));
if (line == NULL)
{
ccx_common_logging.fatal_ftn(EXIT_NOT_ENOUGH_MEMORY,
"In telx_correct_case: Not enough memory for line copy.\n");
}
char *oline = (char *)sub_line;
char *c = strtok(line, delim);
if (c == NULL)
Expand Down
2 changes: 2 additions & 0 deletions src/lib_ccx/configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ static int set_string(void *var, char *val)

val1 = strdup(val);
if (val1 == NULL)
{
fatal(EXIT_NOT_ENOUGH_MEMORY,
"In set_string: Not enough memory for string copy.\n");
}
*p = val1;
return 0;
}
Expand Down
2 changes: 2 additions & 0 deletions src/lib_ccx/hardsubx.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,10 @@ struct lib_hardsubx_ctx *_init_hardsubx(struct ccx_s_options *options)
ctx->tess_handle = TessBaseAPICreate();
char *pars_vec = strdup("debug_file");
if (pars_vec == NULL)
{
fatal(EXIT_NOT_ENOUGH_MEMORY,
"In _init_hardsubx: Not enough memory for pars_vec.\n");
}
char *pars_values = strdup("/dev/null");
if (pars_values == NULL)
{
Expand Down
8 changes: 8 additions & 0 deletions src/lib_ccx/hardsubx_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,10 @@ void hardsubx_process_frames_linear(struct lib_hardsubx_ctx *ctx, struct encoder
{
prev_subtitle_text = strdup(subtitle_text);
if (prev_subtitle_text == NULL)
{
fatal(EXIT_NOT_ENOUGH_MEMORY,
"In hardsubx_process_frames_linear: Not enough memory for subtitle text.\n");
}
prev_sub_encoded = 0;
}
}
Expand All @@ -255,8 +257,10 @@ void hardsubx_process_frames_linear(struct lib_hardsubx_ctx *ctx, struct encoder
prev_end_time = convert_pts_to_ms(ctx->packet.pts, ctx->format_ctx->streams[ctx->video_stream_id]->time_base);
prev_subtitle_text = strdup(subtitle_text);
if (prev_subtitle_text == NULL)
{
fatal(EXIT_NOT_ENOUGH_MEMORY,
"In hardsubx_process_frames_linear: Not enough memory for subtitle text.\n");
}
prev_sub_encoded = 0;
}
prev_packet_pts = ctx->packet.pts;
Expand Down Expand Up @@ -521,8 +525,10 @@ void process_hardsubx_linear_frames_and_normal_subs(struct lib_hardsubx_ctx *har
{
prev_subtitle_text_hard = strdup(subtitle_text_hard);
if (prev_subtitle_text_hard == NULL)
{
fatal(EXIT_NOT_ENOUGH_MEMORY,
"In process_hardsubx_linear_frames_and_normal_subs: Not enough memory for subtitle text.\n");
}
prev_sub_encoded_hard = 0;
}
}
Expand All @@ -535,8 +541,10 @@ void process_hardsubx_linear_frames_and_normal_subs(struct lib_hardsubx_ctx *har
prev_end_time_hard = convert_pts_to_ms(hard_ctx->packet.pts, hard_ctx->format_ctx->streams[hard_ctx->video_stream_id]->time_base);
prev_subtitle_text_hard = strdup(subtitle_text_hard);
if (prev_subtitle_text_hard == NULL)
{
fatal(EXIT_NOT_ENOUGH_MEMORY,
"In process_hardsubx_linear_frames_and_normal_subs: Not enough memory for subtitle text.\n");
}
prev_sub_encoded_hard = 0;
}
prev_packet_pts_hard = hard_ctx->packet.pts;
Expand Down
2 changes: 2 additions & 0 deletions src/lib_ccx/ocr.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,10 @@ static char *ocr_single_line(struct ocrCtx *ctx, PIX *line_pix)
text = strdup(tess_text);
TessDeleteText(tess_text);
if (text == NULL)
{
fatal(EXIT_NOT_ENOUGH_MEMORY,
"In ocr_single_line: Not enough memory for OCR text.\n");
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/lib_ccx/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ int init_write(struct ccx_s_write *wb, char *filename, int with_semaphore)
wb->filename = filename;
wb->original_filename = strdup(filename);
if (wb->original_filename == NULL)
{
fatal(EXIT_NOT_ENOUGH_MEMORY,
"In init_write: Not enough memory for original filename.\n");
}

wb->with_semaphore = with_semaphore;
wb->append_mode = ccx_options.enc_cfg.append_mode;
Expand Down
Loading