Commit ebdcfe27 authored by Petri Hintukainen's avatar Petri Hintukainen

Check str_printf result

parent 98e27226
......@@ -136,6 +136,10 @@ static void *_jvm_dlopen(const char *java_home, const char *jvm_dir, const char
{
if (java_home) {
char *path = str_printf("%s/%s/%s", java_home, jvm_dir, jvm_lib);
if (!path) {
BD_DEBUG(DBG_CRIT, "out of memory\n");
return NULL;
}
BD_DEBUG(DBG_BDJ, "Opening %s ...\n", path);
void *h = dl_dlopen(path, NULL);
X_FREE(path);
......
......@@ -403,15 +403,20 @@ static void _fill_clip(NAV_TITLE *title,
strncpy(&clip->name[5], ".m2ts", 6);
clip->clip_id = atoi(mpls_clip[clip->angle].clip_id);
file = str_printf("%s.clpi", mpls_clip[clip->angle].clip_id);
clpi_free(clip->cl);
clip->cl = clpi_get(title->disc, file);
X_FREE(file);
clip->cl = NULL;
file = str_printf("%s.clpi", mpls_clip[clip->angle].clip_id);
if (file) {
clip->cl = clpi_get(title->disc, file);
X_FREE(file);
}
if (clip->cl == NULL) {
clip->start_pkt = 0;
clip->end_pkt = 0;
return;
}
switch (connection_condition) {
case 5:
case 6:
......
......@@ -2081,12 +2081,14 @@ static int _preload_textst_subpath(BLURAY *bd)
gc_add_font(bd->graphics_controller, NULL, -1);
for (ii = 0; ii < bd->st_textst.clip->cl->font_info.font_count; ii++) {
char *file = str_printf("%s.otf", bd->st_textst.clip->cl->font_info.font[ii].file_id);
uint8_t *data = NULL;
size_t size = disc_read_file(bd->disc, "BDMV" DIR_SEP "AUXDATA", file, &data);
if (data && size > 0 && gc_add_font(bd->graphics_controller, data, size) < 0) {
X_FREE(data);
if (file) {
uint8_t *data = NULL;
size_t size = disc_read_file(bd->disc, "BDMV" DIR_SEP "AUXDATA", file, &data);
if (data && size > 0 && gc_add_font(bd->graphics_controller, data, size) < 0) {
X_FREE(data);
}
X_FREE(file);
}
X_FREE(file);
}
gc_run(bd->graphics_controller, GC_CTRL_PG_CHARCODE, char_code, NULL);
......@@ -2285,9 +2287,14 @@ static int _open_playlist(BLURAY *bd, const char *f_name, unsigned angle)
int bd_select_playlist(BLURAY *bd, uint32_t playlist)
{
char *f_name = str_printf("%05d.mpls", playlist);
char *f_name;
int result;
f_name = str_printf("%05d.mpls", playlist);
if (!f_name) {
return 0;
}
bd_mutex_lock(&bd->mutex);
if (bd->title_list) {
......@@ -2637,9 +2644,14 @@ BLURAY_TITLE_INFO* bd_get_title_info(BLURAY *bd, uint32_t title_idx, unsigned an
BLURAY_TITLE_INFO* bd_get_playlist_info(BLURAY *bd, uint32_t playlist, unsigned angle)
{
char *f_name = str_printf("%05d.mpls", playlist);
char *f_name;
BLURAY_TITLE_INFO *title_info;
f_name = str_printf("%05d.mpls", playlist);
if (!f_name) {
return NULL;
}
title_info = _get_title_info(bd, 0, playlist, f_name, angle);
X_FREE(f_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment