Mercurial > libavformat.hg
changeset 6107:5ad38b8596b2 libavformat
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
author | mstorsjo |
---|---|
date | Tue, 08 Jun 2010 11:18:22 +0000 |
parents | 44ee60d0c688 |
children | 117b1826ce8e |
files | http.c |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/http.c Tue Jun 08 11:06:36 2010 +0000 +++ b/http.c Tue Jun 08 11:18:22 2010 +0000 @@ -131,6 +131,7 @@ fail: if (hd) url_close(hd); + s->hd = NULL; return AVERROR(EIO); } @@ -149,6 +150,7 @@ 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,7 +454,8 @@ ret = ret > 0 ? 0 : ret; } - url_close(s->hd); + if (s->hd) + url_close(s->hd); av_free(s); return ret; }