[vlc-devel] commit: Fix warning and potential memleak. ( Rémi Duraffort )

git version control git at videolan.org
Sun Aug 17 21:50:13 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sun Aug 17 21:31:27 2008 +0200| [40f3bf68fab645c75f4afa8ebc415b133488cb15] | committer: Rémi Duraffort 

Fix warning and potential memleak.

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

 modules/access/directory.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/access/directory.c b/modules/access/directory.c
index 6ceae94..03a5a50 100644
--- a/modules/access/directory.c
+++ b/modules/access/directory.c
@@ -189,6 +189,7 @@ static void Close( vlc_object_t * p_this )
  *****************************************************************************/
 static ssize_t ReadNull( access_t *p_access, uint8_t *p_buffer, size_t i_len)
 {
+    (void)p_access;
     /* Return fake data */
     memset( p_buffer, 0, i_len );
     return i_len;
@@ -201,7 +202,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len)
 {
     char               *psz;
     int                 i_mode;
-    char               *psz_name = strdup (p_access->psz_path);
+    char               *psz_name = strdup( p_access->psz_path );
 
     if( psz_name == NULL )
         return VLC_ENOMEM;
@@ -216,6 +217,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len)
     if( !p_input )
     {
         msg_Err( p_access, "unable to find input (internal error)" );
+        free( psz_name );
         pl_Release( p_access );
         return VLC_ENOOBJ;
     }
@@ -227,6 +229,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len)
     {
         msg_Err( p_access, "unable to find item in playlist" );
         vlc_object_release( p_input );
+        free( psz_name );
         pl_Release( p_access );
         return VLC_ENOOBJ;
     }
@@ -340,6 +343,7 @@ static int DemuxOpen ( vlc_object_t *p_this )
  *****************************************************************************/
 static int Demux( demux_t *p_demux )
 {
+    (void)p_demux;
     return 0;
 }
 
@@ -530,7 +534,7 @@ static int ReadDir( access_t *p_access, playlist_t *p_playlist,
 
                 memmove (psz_uri + 7, psz_uri, sizeof (psz_uri) - 7);
                 memcpy (psz_uri, "file://", 7);
-                p_input = input_item_NewWithType( p_playlist,
+                p_input = input_item_NewWithType( VLC_OBJECT( p_playlist ),
                                                  psz_uri, entry, 0, NULL,
                                                  -1, ITEM_TYPE_FILE );
                 if (p_input != NULL)




More information about the vlc-devel mailing list