Skip to content

Commit efb2742

Browse files
committed
demux: ttml: store array allocation
1 parent b5dd3cb commit efb2742

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

modules/demux/ttml.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ struct demux_sys_t
6565
{
6666
subtitle_t* p_array;
6767
size_t i_count;
68+
size_t i_alloc;
6869
size_t i_current;
6970
} subs;
7071

@@ -585,7 +586,6 @@ static int ReadTTML( demux_t* p_demux )
585586
node_t* p_node = NULL;
586587
char* psz_text = NULL;
587588
const char* psz_node_name;
588-
int i_max_sub = 0;
589589
int i_type;
590590

591591
do
@@ -626,11 +626,11 @@ static int ReadTTML( demux_t* p_demux )
626626

627627
if( p_node->psz_begin && p_node->psz_end )
628628
{
629-
if( p_sys->subs.i_count >= i_max_sub )
629+
if( p_sys->subs.i_count >= p_sys->subs.i_alloc )
630630
{
631-
i_max_sub += 500;
631+
p_sys->subs.i_alloc += 500;
632632
subtitle_t* p_subtitles = realloc( p_sys->subs.p_array,
633-
sizeof( *p_sys->subs.p_array ) * i_max_sub );
633+
sizeof( *p_sys->subs.p_array ) * p_sys->subs.i_alloc );
634634
if( unlikely( p_subtitles == NULL ) )
635635
goto error;
636636
p_sys->subs.p_array = p_subtitles;

0 commit comments

Comments
 (0)