summaryrefslogtreecommitdiffstats
path: root/libavformat/hlsenc.c
diff options
context:
space:
mode:
authorKarthick J <kjeyapal@akamai.com>2018-12-10 14:17:55 +0800
committerSteven Liu <lq@chinaffmpeg.org>2018-12-10 14:17:55 +0800
commit56503a692534e0a703c4d0117cd769c4d573c79c (patch)
treef0e86955a992d9e6cbd0c95f39000e8ed0663f57 /libavformat/hlsenc.c
parent1c96d2e3998b9a2a97447547cb2d688ec0ce09ed (diff)
downloadffmpeg-streaming-56503a692534e0a703c4d0117cd769c4d573c79c.zip
ffmpeg-streaming-56503a692534e0a703c4d0117cd769c4d573c79c.tar.gz
avformat/hlsenc: Handled error from ff_http_do_new_request() function
This patch fixes the segmentation fault issues due to unhandled errors from ff_http_do_new_request function. Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Diffstat (limited to 'libavformat/hlsenc.c')
-rw-r--r--libavformat/hlsenc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 31ef023..42adcfb 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -241,6 +241,9 @@ static int hlsenc_io_open(AVFormatContext *s, AVIOContext **pb, char *filename,
URLContext *http_url_context = ffio_geturlcontext(*pb);
av_assert0(http_url_context);
err = ff_http_do_new_request(http_url_context, filename);
+ if (err < 0)
+ ff_format_io_close(s, pb);
+
#endif
}
return err;
@@ -249,6 +252,8 @@ static int hlsenc_io_open(AVFormatContext *s, AVIOContext **pb, char *filename,
static void hlsenc_io_close(AVFormatContext *s, AVIOContext **pb, char *filename) {
HLSContext *hls = s->priv_data;
int http_base_proto = filename ? ff_is_http_proto(filename) : 0;
+ if (!*pb)
+ return;
if (!http_base_proto || !hls->http_persistent || hls->key_info_file || hls->encrypt) {
ff_format_io_close(s, pb);
#if CONFIG_HTTP_PROTOCOL
@@ -2329,7 +2334,8 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
}
vs->packets_written++;
- ret = ff_write_chained(oc, stream_index, pkt, s, 0);
+ if (oc->pb)
+ ret = ff_write_chained(oc, stream_index, pkt, s, 0);
return ret;
}
OpenPOWER on IntegriCloud