[Mplayer-cvslog] CVS: main/libmpdemux http.c,1.12,1.13

Bertrand Baudet bertrand at mplayerhq.hu
Thu Jun 20 09:59:04 CEST 2002


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv3525

Modified Files:
	http.c 
Log Message:
Removed unecessary malloc and memcpy.


Index: http.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/http.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- http.c	30 Apr 2002 16:58:54 -0000	1.12
+++ http.c	20 Jun 2002 07:58:52 -0000	1.13
@@ -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;




More information about the MPlayer-cvslog mailing list