From 607b545809d15bf655bd4b50ff68206d8aa97fb8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Fri, 21 Dec 2007 15:56:50 +0000 Subject: [PATCH] - Fix error handling - Fix a warning --- 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 9ca4ac688c..9ba058116d 100644 --- a/modules/access/udp.c +++ b/modules/access/udp.c @@ -326,16 +326,17 @@ static block_t *BlockUDP( access_t *p_access ) { access_sys_t *p_sys = p_access->p_sys; block_t *p_block; + ssize_t len; if( p_access->info.b_eof ) return NULL; /* Read data */ p_block = block_New( p_access, MTU ); - p_block->i_buffer = net_Read( p_access, p_sys->fd, NULL, - p_block->p_buffer, MTU, VLC_FALSE ); - if( ( p_block->i_buffer < 0 ) - || ( p_sys->b_comedia && ( p_block->i_buffer == 0 ) ) ) + len = net_Read( p_access, p_sys->fd, NULL, + p_block->p_buffer, MTU, VLC_FALSE ); + if( ( len < 0 ) + || ( p_sys->b_comedia && ( len == 0 ) ) ) { if( p_sys->b_comedia ) { @@ -346,7 +347,7 @@ static block_t *BlockUDP( access_t *p_access ) return NULL; } - return block_Realloc( p_block, 0, p_block->i_buffer ); + return block_Realloc( p_block, 0, p_block->i_buffer = len ); } /***************************************************************************** @@ -395,7 +396,7 @@ static block_t *BlockTCP( access_t *p_access ) p_block->i_buffer += i_read; } - if( p_block->i_buffer < (2 + framelen) ) + if( p_block->i_buffer < (2u + framelen) ) return NULL; // incomplete frame /* Hide framing from RTP layer */ -- 2.20.1