]> git.sesse.net Git - vlc/commitdiff
* modules/demux/real.c, modules/access/rtsp: fixed a bunch of memory leaks.
authorGildas Bazin <gbazin@videolan.org>
Sun, 4 Dec 2005 19:13:29 +0000 (19:13 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sun, 4 Dec 2005 19:13:29 +0000 (19:13 +0000)
modules/access/rtsp/access.c
modules/access/rtsp/real_asmrp.c
modules/access/rtsp/real_sdpplin.c
modules/access/rtsp/rtsp.c
modules/demux/real.c

index e6d5b5aae4888a4ff159f722efbb99188f8ec839..0cbcc891b14e501c5c9104771cc692a9b1dc8b23 100644 (file)
@@ -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:
index d13796caec1a505e2dd4366287cf0c2039715e99..fbd2d8826aaeae4cc04ebf03d3952befa1ecd86c 100644 (file)
@@ -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);
 }
 
index d7222eddbd813007b7bb936d89f23d9dcec6d578..bc332c7be8a4a278b555580996bcf15cc55a8add 100644 (file)
@@ -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 );
index c56ab6d90116e148ad4da211a37c9919679db038..94de904f60a39bf9b2d2d244bbb23bd3596361f7 100644 (file)
@@ -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 );
index b1a785a3f245c262d3fbafea887960029d1fe607..1c773f36e7e194996edb95f092ebe72dce80532e 100644 (file)
@@ -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 )