[vlc-devel] commit: Fix NULL deref (CID#237) ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Oct 12 13:13:17 CEST 2008


vlc | branch: 0.9-bugfix | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Oct 12 11:25:40 2008 +0300| [11167f9c6451f53134eadc12e38741f870e6c663] | committer: Rémi Denis-Courmont 

Fix NULL deref (CID#237)
(cherry picked from commit d3ab3afe55aaaf9dda782de90ff97f2696738300)

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

 modules/control/http/macro.c |   26 +++++++++-----------------
 1 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/modules/control/http/macro.c b/modules/control/http/macro.c
index 7dde365..b98d424 100644
--- a/modules/control/http/macro.c
+++ b/modules/control/http/macro.c
@@ -338,25 +338,17 @@ static void MacroDo( httpd_file_sys_t *p_args,
 
                     p_input = MRLParse( p_intf, mrl, psz_name );
 
-                    char *psz_uri = input_item_GetURI( p_input );
-                    if( !p_input || !psz_uri || !*psz_uri )
-                    {
-                        msg_Dbg( p_intf, "invalid requested mrl: %s", mrl );
-                    }
+                    char *psz_uri = p_input ? input_item_GetURI( p_input ) : NULL;
+                    if( psz_uri && *psz_uri &&
+                        playlist_AddInput( p_sys->p_playlist, p_input,
+                                           PLAYLIST_APPEND, PLAYLIST_END,
+                                           true, false) == VLC_SUCCESS )
+                        msg_Dbg( p_intf, "requested mrl add: %s", mrl );
                     else
-                    {
-                        int i_ret = playlist_AddInput( p_sys->p_playlist,
-                                     p_input,
-                                     PLAYLIST_APPEND, PLAYLIST_END, true,
-                                     false);
-                        vlc_gc_decref( p_input );
-                        if( i_ret == VLC_SUCCESS )
-                            msg_Dbg( p_intf, "requested mrl add: %s", mrl );
-                        else
-                            msg_Warn( p_intf, "adding mrl %s failed", mrl );
-                    }
+                        msg_Warn( p_intf, "adding mrl failed: %s", mrl );
                     free( psz_uri );
-
+                    if( p_input )
+                        vlc_gc_decref( p_input );
                     break;
                 }
                 case MVLC_DEL:




More information about the vlc-devel mailing list