# HG changeset patch # User mstorsjo # Date 1275995902 0 # Node ID 5ad38b8596b23d582b4478c0a70a9105c39f35f3 # Parent 44ee60d0c688d0a8122d2013990b337e673a25f1 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 diff -r 44ee60d0c688 -r 5ad38b8596b2 http.c --- 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; }