changeset 6465:b59ad8bbbd72

Removed unecessary malloc and memcpy.
author bertrand
date Thu, 20 Jun 2002 07:58:52 +0000
parents 60211818e5b9
children ebffa928a5d4
files libmpdemux/http.c
diffstat 1 files changed, 2 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/http.c	Wed Jun 19 23:44:42 2002 +0000
+++ b/libmpdemux/http.c	Thu Jun 20 07:58:52 2002 +0000
@@ -30,7 +30,6 @@
 	if( http_hdr->protocol!=NULL ) free( http_hdr->protocol );
 	if( http_hdr->uri!=NULL ) free( http_hdr->uri );
 	if( http_hdr->reason_phrase!=NULL ) free( http_hdr->reason_phrase );
-	if( http_hdr->body!=NULL ) free( http_hdr->body );
 	if( http_hdr->field_search!=NULL ) free( http_hdr->field_search );
 	if( http_hdr->method!=NULL ) free( http_hdr->method );
 	if( http_hdr->buffer!=NULL ) free( http_hdr->buffer );
@@ -164,14 +163,8 @@
 
 	if( pos_hdr_sep+4<http_hdr->buffer_size ) {
 		// Response has data!
-		int data_length = http_hdr->buffer_size-(pos_hdr_sep+4);
-		http_hdr->body = (char*)malloc( data_length );
-		if( http_hdr->body==NULL ) {
-			mp_msg(MSGT_NETWORK,MSGL_ERR,"Memory allocation failed\n");
-			return -1;
-		}
-		memcpy( http_hdr->body, http_hdr->buffer+pos_hdr_sep+4, data_length );
-		http_hdr->body_size = data_length;
+		http_hdr->body = http_hdr->buffer+pos_hdr_sep+4;
+		http_hdr->body_size = http_hdr->buffer_size-(pos_hdr_sep+4);
 	}
 
 	http_hdr->is_parsed = 1;