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
Originally committed as revision 23529 to svn://svn.ffmpeg.org/ffmpeg/trunk
... | ... |
@@ -131,6 +131,7 @@ static int http_open_cnx(URLContext *h) |
131 | 131 |
fail: |
132 | 132 |
if (hd) |
133 | 133 |
url_close(hd); |
134 |
+ s->hd = NULL; |
|
134 | 135 |
return AVERROR(EIO); |
135 | 136 |
} |
136 | 137 |
|
... | ... |
@@ -149,6 +150,7 @@ static int http_open(URLContext *h, const char *uri, int flags) |
149 | 149 |
s->chunksize = -1; |
150 | 150 |
s->off = 0; |
151 | 151 |
s->init = 0; |
152 |
+ s->hd = NULL; |
|
152 | 153 |
*s->headers = '\0'; |
153 | 154 |
memset(&s->auth_state, 0, sizeof(s->auth_state)); |
154 | 155 |
av_strlcpy(s->location, uri, URL_SIZE); |
... | ... |
@@ -452,7 +454,8 @@ static int http_close(URLContext *h) |
452 | 452 |
ret = ret > 0 ? 0 : ret; |
453 | 453 |
} |
454 | 454 |
|
455 |
- url_close(s->hd); |
|
455 |
+ if (s->hd) |
|
456 |
+ url_close(s->hd); |
|
456 | 457 |
av_free(s); |
457 | 458 |
return ret; |
458 | 459 |
} |