[vlc-devel] commit: Fix use-after-free (CID 129) ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat May 31 21:54:57 CEST 2008


vlc | branch: 0.8.6-bugfix | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat May 31 22:56:34 2008 +0300| [acbb80d119d5dabc9188b586498890336d5ebcab]

Fix use-after-free (CID 129)

bugfix-only - the network code has been completely rewritten since

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=acbb80d119d5dabc9188b586498890336d5ebcab
---

 modules/misc/network/ipv4.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/modules/misc/network/ipv4.c b/modules/misc/network/ipv4.c
index 062e9bf..df6d62d 100644
--- a/modules/misc/network/ipv4.c
+++ b/modules/misc/network/ipv4.c
@@ -279,9 +279,6 @@ static int OpenUDP( vlc_object_t * p_this )
             else
                 imr.imr_interface.s_addr = INADDR_ANY;
 
-            if( psz_if_addr != NULL )
-                free( psz_if_addr );
-
             msg_Dbg( p_this, "IP_ADD_SOURCE_MEMBERSHIP multicast request" );
 
             /* Join Multicast group with source filter */
@@ -368,8 +365,6 @@ igmpv2:
                 if( hiphlpapi ) FreeLibrary( hiphlpapi );
             }
 #endif
-            if( psz_if_addr != NULL ) free( psz_if_addr );
-
             msg_Dbg( p_this, "IP_ADD_MEMBERSHIP multicast request" );
             /* Join Multicast group without source filter */
             if( setsockopt( i_handle, IPPROTO_IP, IP_ADD_MEMBERSHIP,
@@ -378,9 +373,11 @@ igmpv2:
                 msg_Err( p_this, "failed to join IP multicast group (%s)",
                                   strerror(errno) );
                 close( i_handle );
+                free( psz_if_addr );
                 return 0;
             }
-         }
+        }
+        free( psz_if_addr );
     }
 
 #if !defined (__linux__) && !defined (WIN32)




More information about the vlc-devel mailing list