[vlc-commits] mmsh: initialize callbacks at the end of probing

Rémi Denis-Courmont git at videolan.org
Tue Feb 21 22:09:25 CET 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Feb 21 22:55:42 2017 +0200| [5ea9b09dc2e054a0d84071a21f055618190958d1] | committer: Rémi Denis-Courmont

mmsh: initialize callbacks at the end of probing

This avoids setting wrong callbacks on failure.

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

 modules/access/mms/mmsh.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/access/mms/mmsh.c b/modules/access/mms/mmsh.c
index 240b779..476a4aa 100644
--- a/modules/access/mms/mmsh.c
+++ b/modules/access/mms/mmsh.c
@@ -75,11 +75,13 @@ static int Reset( access_t * );
  ****************************************************************************/
 int MMSHOpen( access_t *p_access )
 {
-    access_sys_t    *p_sys;
+    access_sys_t    *p_sys = calloc( 1, sizeof( *p_sys ) );
     char            *psz_location = NULL;
 
-    STANDARD_BLOCK_ACCESS_INIT
+    if( unlikely(p_sys == NULL) )
+        return VLC_ENOMEM;
 
+    p_access->p_sys = p_sys;
     p_sys->i_proto= MMS_PROTO_HTTP;
     p_sys->fd     = -1;
     p_sys->i_position = 0;
@@ -144,6 +146,7 @@ int MMSHOpen( access_t *p_access )
         goto error;
     }
 
+    ACCESS_SET_CALLBACKS( NULL, Block, Control, Seek );
     return VLC_SUCCESS;
 
 error:



More information about the vlc-commits mailing list