diff options
author | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2010-07-19 19:56:48 +0100 |
---|---|---|
committer | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2010-07-19 19:56:48 +0100 |
commit | dec217438b63373fefd6f50c85664f57148efe50 (patch) | |
tree | 2b1f869f76704b3c3ffa8201dd57588492c68a2f /src/libspucmml | |
parent | 88682e14a4c89caa499fedad2a3faab316f72dda (diff) | |
download | xine-lib-dec217438b63373fefd6f50c85664f57148efe50.tar.gz xine-lib-dec217438b63373fefd6f50c85664f57148efe50.tar.bz2 |
Fix a few small memory leaks.
Diffstat (limited to 'src/libspucmml')
-rw-r--r-- | src/libspucmml/xine_cmml_decoder.c | 11 |
1 files changed, 6 insertions, 5 deletions
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 (i<SUB_BUFSIZE-1) i++; } - anchor_text++; + index++; } /* always NULL-terminate the string */ @@ -355,6 +355,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { this->lines++; } } + free (anchor_text); /* initialize decoder if needed */ if( !this->cached_width || !this->cached_height || !this->cached_img_duration || !this->osd ) { |