vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Tue Apr 30 
17:53:21 2013 +0300| [a7440cbaed95336667709a5a7717a78bb2c18b52] | committer: 
Rémi Denis-Courmont

udp: handle error

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

 modules/access/udp.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/modules/access/udp.c b/modules/access/udp.c
index 08db9d1..6613ebe 100644
--- a/modules/access/udp.c
+++ b/modules/access/udp.c
@@ -198,14 +198,15 @@ static int Control( access_t *p_access, int i_query, 
va_list args )
  *****************************************************************************/
 static block_t *BlockUDP( access_t *p_access )
 {
-    access_sys_t *p_sys = p_access->p_sys;
-    block_t      *p_block;
-    ssize_t len;
+    int fd = (intptr_t)p_access->p_sys;
 
     /* Read data */
-    p_block = block_Alloc( MTU );
-    len = net_Read( p_access, (intptr_t)p_sys, NULL,
-                    p_block->p_buffer, MTU, false );
+    block_t *p_block = block_Alloc( MTU );
+    if( unlikely(p_block == NULL) )
+        return NULL;
+
+    ssize_t len = net_Read( p_access, fd, NULL,
+                            p_block->p_buffer, MTU, false );
     if( len < 0 )
     {
         block_Release( p_block );

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to