# HG changeset patch # User mstorsjo # Date 1277215954 0 # Node ID 4c0017a87855110f7e4f93d02863dfe84193908a # Parent f7090c70ed3473f4d78a225374b6da484fa51c8a Allocate the HTTPContext through URLProtocol.priv_data_size diff -r f7090c70ed34 -r 4c0017a87855 http.c --- a/http.c Tue Jun 22 14:09:08 2010 +0000 +++ b/http.c Tue Jun 22 14:12:34 2010 +0000 @@ -147,22 +147,12 @@ static int http_open(URLContext *h, const char *uri, int flags) { - HTTPContext *s; + HTTPContext *s = h->priv_data; h->is_streamed = 1; - s = av_malloc(sizeof(HTTPContext)); - if (!s) { - return AVERROR(ENOMEM); - } - h->priv_data = s; s->filesize = -1; s->chunksize = 0; /* Default to chunked POSTs */ - s->off = 0; - s->init = 0; - s->hd = NULL; - *s->headers = '\0'; - memset(&s->auth_state, 0, sizeof(s->auth_state)); av_strlcpy(s->location, uri, URL_SIZE); return 0; @@ -469,7 +459,6 @@ if (s->hd) url_close(s->hd); - av_free(s); return ret; } @@ -532,4 +521,5 @@ http_seek, http_close, .url_get_file_handle = http_get_file_handle, + .priv_data_size = sizeof(HTTPContext), };