[vlc-devel] commit: rtmp: factorize a bit. ( Rémi Duraffort )

git version control git at videolan.org
Wed Nov 18 12:48:31 CET 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed Nov 18 12:44:29 2009 +0100| [df15163a91887272e0e45020917a0504c8e8961e] | committer: Rémi Duraffort 

rtmp: factorize a bit.

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

 modules/access/rtmp/access.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/modules/access/rtmp/access.c b/modules/access/rtmp/access.c
index d68ec00..272f1a2 100644
--- a/modules/access/rtmp/access.c
+++ b/modules/access/rtmp/access.c
@@ -406,12 +406,8 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
             i_ret = net_Write( p_sys->p_thread, p_sys->p_thread->fd, NULL, tmp_buffer, rtmp_packet->length_encoded );
             if( i_ret != rtmp_packet->length_encoded )
             {
-                free( rtmp_packet->body->body );
-                free( rtmp_packet->body );
-                free( rtmp_packet );
-                free( tmp_buffer );
                 msg_Err( p_access, "failed send publish start" );
-                return -1;
+                goto error;
             }
             free( rtmp_packet->body->body );
             free( rtmp_packet->body );
@@ -428,11 +424,8 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
         i_ret = net_Write( p_sys->p_thread, p_sys->p_thread->fd, NULL, tmp_buffer, rtmp_packet->length_encoded );
         if( i_ret != rtmp_packet->length_encoded )
         {
-            free( rtmp_packet->body->body );
-            free( rtmp_packet->body );
-            free( rtmp_packet );
-            free( tmp_buffer );
             msg_Err( p_access, "failed send bytes read" );
+            goto error;
             return -1;
         }
         free( rtmp_packet->body->body );
@@ -442,6 +435,13 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
     }
 
     return i_len_tmp;
+
+error:
+    free( rtmp_packet->body->body );
+    free( rtmp_packet->body );
+    free( rtmp_packet );
+    free( tmp_buffer );
+    return -1;
 }
 
 /*****************************************************************************




More information about the vlc-devel mailing list