Commit 8b85798d authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Jean-Baptiste Kempf

smb: Fix use after free

CID #1461260

(cherry picked from commit b7e3e156)
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 92c10217
...@@ -436,7 +436,6 @@ static int DirRead (stream_t *p_access, input_item_node_t *p_node ) ...@@ -436,7 +436,6 @@ static int DirRead (stream_t *p_access, input_item_node_t *p_node )
i_ret = VLC_ENOMEM; i_ret = VLC_ENOMEM;
break; break;
} }
free( psz_name );
// We need to concatenate the scheme before, as the window version // We need to concatenate the scheme before, as the window version
// of smb_get_uri generates a path (and the other call site needs // of smb_get_uri generates a path (and the other call site needs
// a path). The path is already prefixed by "//" so we just need // a path). The path is already prefixed by "//" so we just need
...@@ -444,6 +443,7 @@ static int DirRead (stream_t *p_access, input_item_node_t *p_node ) ...@@ -444,6 +443,7 @@ static int DirRead (stream_t *p_access, input_item_node_t *p_node )
char* psz_uri; char* psz_uri;
if( asprintf( &psz_uri, "file:%s", psz_path ) < 0 ) if( asprintf( &psz_uri, "file:%s", psz_path ) < 0 )
{ {
free( psz_name );
free( psz_path ); free( psz_path );
i_ret = VLC_ENOMEM; i_ret = VLC_ENOMEM;
break; break;
...@@ -452,6 +452,7 @@ static int DirRead (stream_t *p_access, input_item_node_t *p_node ) ...@@ -452,6 +452,7 @@ static int DirRead (stream_t *p_access, input_item_node_t *p_node )
i_ret = vlc_readdir_helper_additem( &rdh, psz_uri, NULL, i_ret = vlc_readdir_helper_additem( &rdh, psz_uri, NULL,
psz_name, ITEM_TYPE_DIRECTORY, ITEM_NET ); psz_name, ITEM_TYPE_DIRECTORY, ITEM_NET );
free( psz_name );
free( psz_uri ); free( psz_uri );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment