From a65b35246f797631dd3012e52fb11ce38a3c6d32 Mon Sep 17 00:00:00 2001 From: Gildas Bazin <gbazin@videolan.org> Date: Sun, 4 Dec 2005 19:13:29 +0000 Subject: [PATCH] * modules/demux/real.c, modules/access/rtsp: fixed a bunch of memory leaks. --- modules/access/rtsp/access.c | 4 +++- modules/access/rtsp/real_asmrp.c | 4 +++- modules/access/rtsp/real_sdpplin.c | 5 +++-- modules/access/rtsp/rtsp.c | 8 +++++--- modules/demux/real.c | 17 ++++------------- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/modules/access/rtsp/access.c b/modules/access/rtsp/access.c index e6d5b5aae488..0cbcc891b14e 100644 --- a/modules/access/rtsp/access.c +++ b/modules/access/rtsp/access.c @@ -2,7 +2,7 @@ * access.c: Real rtsp input ***************************************************************************** * Copyright (C) 2005 VideoLAN - * $Id: file.c 10310 2005-03-11 22:36:40Z anil $ + * $Id$ * * Authors: Gildas Bazin <gbazin@videolan.org> * @@ -220,6 +220,7 @@ static int Open( vlc_object_t *p_this ) p_sys->p_header = block_New( p_access, 4096 ); p_sys->p_header->i_buffer = rmff_dump_header( h, p_sys->p_header->p_buffer, 1024 ); + rmff_free_header( h ); } else { @@ -231,6 +232,7 @@ static int Open( vlc_object_t *p_this ) var_Create( p_access, "realrtsp-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT); + if( psz_server ) free( psz_server ); return VLC_SUCCESS; error: diff --git a/modules/access/rtsp/real_asmrp.c b/modules/access/rtsp/real_asmrp.c index d13796caec1a..fbd2d8826aae 100644 --- a/modules/access/rtsp/real_asmrp.c +++ b/modules/access/rtsp/real_asmrp.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: asmrp.c,v 1.8 2004/08/27 18:34:16 miguelfreitas Exp $ + * $Id$ * * a parser for real's asm rules * @@ -94,6 +94,7 @@ static asmrp_t *asmrp_new () { p->sym_tab_num = 0; p->sym = ASMRP_SYM_NONE; + p->buf = 0; return p; } @@ -105,6 +106,7 @@ static void asmrp_dispose (asmrp_t *p) { for (i=0; i<p->sym_tab_num; i++) free (p->sym_tab[i].id); + if (p->buf) free (p->buf); free (p); } diff --git a/modules/access/rtsp/real_sdpplin.c b/modules/access/rtsp/real_sdpplin.c index d7222eddbd81..bc332c7be8a4 100644 --- a/modules/access/rtsp/real_sdpplin.c +++ b/modules/access/rtsp/real_sdpplin.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: sdpplin.c,v 1.5 2004/04/23 21:59:04 miguelfreitas Exp $ + * $Id$ * * sdp/sdpplin parser. * @@ -313,9 +313,10 @@ void sdpplin_free(sdpplin_t *description) { if( description->stream[i]->mlti_data ) free( description->stream[i]->mlti_data ); if( description->stream[i]->rmff_flags ) free( description->stream[i]->rmff_flags ); if( description->stream[i]->asm_rule_book ) free( description->stream[i]->asm_rule_book ); + free( description->stream[i] ); } } - free( description->stream ); + if( description->stream_count ) free( description->stream ); if( description->owner ) free( description->owner ); if( description->session_name ) free( description->session_name ); diff --git a/modules/access/rtsp/rtsp.c b/modules/access/rtsp/rtsp.c index c56ab6d90116..94de904f60a3 100644 --- a/modules/access/rtsp/rtsp.c +++ b/modules/access/rtsp/rtsp.c @@ -4,7 +4,7 @@ ***************************************************************************** * Copyright (C) 2002-2004 the xine project * Copyright (C) 2005 VideoLAN - * $Id: file.c 10310 2005-03-11 22:36:40Z anil $ + * $Id$ * * Authors: Gildas Bazin <gbazin@videolan.org> * Adapted from xine which itself adapted it from joschkas real tools. @@ -239,8 +239,7 @@ static int rtsp_get_answers( rtsp_client_t *rtsp ) char *buf = malloc( strlen(answer) ); sscanf( answer, "%*s %s", buf ); if( rtsp->p_private->server ) free( rtsp->p_private->server ); - rtsp->p_private->server = strdup( buf ); - free( buf ); + rtsp->p_private->server = buf; } if( !strncasecmp( answer, "Session:", 8 ) ) { @@ -433,6 +432,7 @@ int rtsp_read_data( rtsp_client_t *rtsp, char *buffer, unsigned int size ) sprintf( rest,"CSeq: %u", seq ); rtsp_put( rtsp, rest ); rtsp_put( rtsp, "" ); + free( rest ); rtsp->pf_read( rtsp->p_userdata, buffer, size ); } else @@ -514,6 +514,7 @@ int rtsp_connect( rtsp_client_t *rtsp, const char *psz_mrl, if( s->port < 0 || s->port > 65535 ) s->port = 554; } + free( mrl_ptr ); fprintf( stderr, "got mrl: %s %i %s\n", s->host, s->port, s->path ); s->s = rtsp->pf_connect( rtsp->p_userdata, s->host, s->port ); @@ -561,6 +562,7 @@ void rtsp_close( rtsp_client_t *rtsp ) if( rtsp->p_private->mrl ) free( rtsp->p_private->mrl ); if( rtsp->p_private->session ) free( rtsp->p_private->session ); if( rtsp->p_private->user_agent ) free( rtsp->p_private->user_agent ); + if( rtsp->p_private->server ) free( rtsp->p_private->server ); rtsp_free_answers( rtsp ); rtsp_unschedule_all( rtsp ); free( rtsp->p_private ); diff --git a/modules/demux/real.c b/modules/demux/real.c index b1a785a3f245..1c773f36e7e1 100644 --- a/modules/demux/real.c +++ b/modules/demux/real.c @@ -146,18 +146,12 @@ static void Close( vlc_object_t *p_this ) { real_track_t *tk = p_sys->track[i]; - if( tk->p_frame ) - { - block_Release( tk->p_frame ); - } + if( tk->p_frame ) block_Release( tk->p_frame ); + es_format_Clean( &tk->fmt ); free( tk ); } - if( p_sys->i_track > 0 ) - { - free( p_sys->track ); - } - + if( p_sys->i_track > 0 ) free( p_sys->track ); free( p_sys ); } @@ -218,10 +212,7 @@ static int Demux( demux_t *p_demux ) for( i = 0; i < p_sys->i_track; i++ ) { - if( p_sys->track[i]->i_id == i_id ) - { - tk = p_sys->track[i]; - } + if( p_sys->track[i]->i_id == i_id ) tk = p_sys->track[i]; } if( tk == NULL ) -- GitLab