changeset 21776:f43ed7e03b06

Fix double free of *http_hdr at server error. In http.c::http_streaming_start() *http_hdr is allocated then assigned to stream->streaming_ctrl->data if server returns error *http_hdr is freed before function returns. However the copy in ->data remains and is later freed (again) by network.c::streaming_ctrl_free().
author iive
date Sat, 30 Dec 2006 13:23:39 +0000
parents acee29a43313
children 3af036ae3c75
files stream/http.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/stream/http.c	Fri Dec 29 22:55:53 2006 +0000
+++ b/stream/http.c	Sat Dec 30 13:23:39 2006 +0000
@@ -749,8 +749,6 @@
 			http_debug_hdr( http_hdr );
 		}
 		
-		stream->streaming_ctrl->data = (void*)http_hdr;
-
 		// Check if we can make partial content requests and thus seek in http-streams
 		if( http_hdr!=NULL && http_hdr->status_code==200 ) {
 		    char *accept_ranges;
@@ -858,7 +856,9 @@
 	fd = -1;
 	res = STREAM_UNSUPORTED;
 	http_free( http_hdr );
+	http_hdr = NULL;
 out:
+	stream->streaming_ctrl->data = (void*)http_hdr;
 	stream->fd = fd;
 	return res;
 }