summaryrefslogtreecommitdiff
path: root/libavformat/http.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2010-06-22 14:12:34 +0000
committerMartin Storsjö <martin@martin.st>2010-06-22 14:12:34 +0000
commita9a3364c310191168aaec172c088dd1a167647f5 (patch)
tree119ed6b52156f8d0dbf7cfd7492f3a05a88f78b2 /libavformat/http.c
parent58cc11c74c6a2d3517fea8840b58c767201a2529 (diff)
Allocate the HTTPContext through URLProtocol.priv_data_size
Originally committed as revision 23708 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/http.c')
-rw-r--r--libavformat/http.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/libavformat/http.c b/libavformat/http.c
index 4a46b41cad..dfeffa1bb0 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -147,22 +147,12 @@ static int http_open_cnx(URLContext *h)
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 @@ static int http_close(URLContext *h)
if (s->hd)
url_close(s->hd);
- av_free(s);
return ret;
}
@@ -532,4 +521,5 @@ URLProtocol http_protocol = {
http_seek,
http_close,
.url_get_file_handle = http_get_file_handle,
+ .priv_data_size = sizeof(HTTPContext),
};