Commit 8dc9dfa3 authored by mstorsjo's avatar mstorsjo

Fix handling of errors in the http protocol

If http_connect fails, we've already stored the new connection handle in s->hd,
so clear it so http_close won't double-free it.

10l to me for not spotting it during review


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23529 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent cbb93100
......@@ -131,6 +131,7 @@ static int http_open_cnx(URLContext *h)
fail:
if (hd)
url_close(hd);
s->hd = NULL;
return AVERROR(EIO);
}
......@@ -149,6 +150,7 @@ static int http_open(URLContext *h, const char *uri, int flags)
s->chunksize = -1;
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);
......@@ -452,6 +454,7 @@ static int http_close(URLContext *h)
ret = ret > 0 ? 0 : ret;
}
if (s->hd)
url_close(s->hd);
av_free(s);
return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment