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/input/pnm.c | 1 + src/libspucmml/xine_cmml_decoder.c | 11 ++++++----- src/post/goom/gfontlib.c | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/input/pnm.c b/src/input/pnm.c index bf24e5f8f..1bbc93fb6 100644 --- a/src/input/pnm.c +++ b/src/input/pnm.c @@ -712,6 +712,7 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { if (strncmp(mrl,"pnm://",6)) { + free (mrl_ptr); return NULL; } 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 ) { diff --git a/src/post/goom/gfontlib.c b/src/post/goom/gfontlib.c index 2bc366305..f538aad34 100644 --- a/src/post/goom/gfontlib.c +++ b/src/post/goom/gfontlib.c @@ -127,6 +127,7 @@ void gfont_load (void) { font_chars [32] = 0; small_font_chars [32] = 0; free(font_pos); + free(gfont); } void goom_draw_text (Pixel * buf,int resolx,int resoly, -- cgit v1.2.3