]> git.sesse.net Git - vlc/commitdiff
Fix memleaks
authorClément Stenac <zorglub@videolan.org>
Sun, 29 Aug 2004 21:26:16 +0000 (21:26 +0000)
committerClément Stenac <zorglub@videolan.org>
Sun, 29 Aug 2004 21:26:16 +0000 (21:26 +0000)
modules/stream_out/standard.c
src/stream_output/sap.c

index 8751d03f98d77769909f14b4b454898d95995834..19c742173bd99638cea6d139aec0fbe74bf1abaf 100644 (file)
@@ -355,6 +355,9 @@ static int Open( vlc_object_t *p_this )
             p_stream->p_sys->p_session = p_session;
         }
         vlc_UrlClean( &url );
+
+        if( p_method->psz_address) free( p_method->psz_address );
+        free( p_method );
     }
 
     /* *** Register with slp *** */
@@ -402,6 +405,7 @@ static int Open( vlc_object_t *p_this )
     if( psz_mux ) free( psz_mux );
     if( psz_url ) free( psz_url );
 
+
     return VLC_SUCCESS;
 }
 
@@ -417,6 +421,7 @@ static void Close( vlc_object_t * p_this )
     if( p_sys->p_session != NULL )
     {
         sout_AnnounceUnRegister( p_stream->p_sout, p_sys->p_session );
+        sout_AnnounceSessionDestroy( p_sys->p_session );
     }
 
 #ifdef HAVE_SLP_H
index 465696897fdb6df6708d2fd08cd70f3ceed2788a..0cb06b281b366984d13281399ee8886a8a07d9fa 100644 (file)
@@ -250,7 +250,7 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap,
         {
             /* IPv4 */
             p_method->psz_address = (char*)malloc( 15*sizeof(char) );
-            sprintf(p_method->psz_address, SAP_IPV4_ADDR );
+            snprintf(p_method->psz_address, 15, SAP_IPV4_ADDR );
         }
     }
     msg_Dbg( p_sap, "using SAP address: %s",p_method->psz_address);
@@ -386,6 +386,8 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap,
     memcpy( p_sap_session->psz_data+i_header_size, p_sap_session->psz_sdp,
             strlen( p_sap_session->psz_sdp) );
 
+    free( psz_head );
+
     /* Enqueue the announce */
     INSERT_ELEM( p_sap->pp_sessions,
                  p_sap->i_sessions,
@@ -425,7 +427,7 @@ static int announce_SAPAnnounceDel( sap_handler_t *p_sap,
 
     /* XXX: Dequeue the address too if it is not used anymore
      * TODO: - address refcount
-             - send a SAP deletion packet */  
+             - send a SAP deletion packet */
 
     msg_Dbg( p_sap,"%i announces remaining", p_sap->i_sessions );