mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-18 21:45:10 +00:00
applehttpproto: Use the close function if the open function fails
This should clean up leaked memory. Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
abe20c59b9
commit
1ca87d600b
@ -174,6 +174,17 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int applehttp_close(URLContext *h)
|
||||
{
|
||||
AppleHTTPContext *s = h->priv_data;
|
||||
|
||||
free_segment_list(s);
|
||||
free_variant_list(s);
|
||||
ffurl_close(s->seg_hd);
|
||||
av_free(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int applehttp_open(URLContext *h, const char *uri, int flags)
|
||||
{
|
||||
AppleHTTPContext *s;
|
||||
@ -229,7 +240,7 @@ static int applehttp_open(URLContext *h, const char *uri, int flags)
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
av_free(s);
|
||||
applehttp_close(h);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -287,17 +298,6 @@ retry:
|
||||
goto start;
|
||||
}
|
||||
|
||||
static int applehttp_close(URLContext *h)
|
||||
{
|
||||
AppleHTTPContext *s = h->priv_data;
|
||||
|
||||
free_segment_list(s);
|
||||
free_variant_list(s);
|
||||
ffurl_close(s->seg_hd);
|
||||
av_free(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
URLProtocol ff_applehttp_protocol = {
|
||||
.name = "applehttp",
|
||||
.url_open = applehttp_open,
|
||||
|
Loading…
Reference in New Issue
Block a user