From dec217438b63373fefd6f50c85664f57148efe50 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 19 Jul 2010 19:56:48 +0100 Subject: Fix a few small memory leaks. --- src/libspucmml/xine_cmml_decoder.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/libspucmml') diff --git a/src/libspucmml/xine_cmml_decoder.c b/src/libspucmml/xine_cmml_decoder.c index ed7e99ae1..87edcfbfe 100644 --- a/src/libspucmml/xine_cmml_decoder.c +++ b/src/libspucmml/xine_cmml_decoder.c @@ -331,9 +331,9 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { /* how many lines does the anchor text take up? */ this->lines=0; { - int i = 0; - while (*anchor_text) { - if (*anchor_text == '\r' || *anchor_text == '\n') { + int i = 0, index = 0; + while (anchor_text[index]) { + if (anchor_text[index] == '\r' || anchor_text[index] == '\n') { if (i) { /* match a newline and there are chars on the current line ... */ this->text[ this->lines ][i] = '\0'; @@ -342,11 +342,11 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { } } else { /* found a normal (non-line-ending) character */ - this->text[ this->lines ][i] = *anchor_text; + this->text[ this->lines ][i] = anchor_text[index]; if (ilines++; } } + free (anchor_text); /* initialize decoder if needed */ if( !this->cached_width || !this->cached_height || !this->cached_img_duration || !this->osd ) { -- cgit v1.2.3