]> git.sesse.net Git - ffmpeg/commitdiff
avformat/hlsenc: Handle NULL input in IO open and close utility functions
authorKarthick J <kjeyapal@akamai.com>
Fri, 15 Dec 2017 14:08:31 +0000 (22:08 +0800)
committerSteven Liu <lq@chinaffmpeg.org>
Fri, 15 Dec 2017 14:14:54 +0000 (22:14 +0800)
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
libavformat/hlsenc.c

index 30d0285c320592f736361be3fc70dce36d725453..af9d949501e3581de4db22cea4e3c1141dcbde21 100644 (file)
@@ -246,7 +246,7 @@ static int is_http_proto(char *filename) {
 static int hlsenc_io_open(AVFormatContext *s, AVIOContext **pb, char *filename,
                           AVDictionary **options) {
     HLSContext *hls = s->priv_data;
-    int http_base_proto = is_http_proto(filename);
+    int http_base_proto = filename ? is_http_proto(filename) : 0;
     int err = AVERROR_MUXER_NOT_FOUND;
     if (!*pb || !http_base_proto || !hls->http_persistent) {
         err = s->io_open(s, pb, filename, AVIO_FLAG_WRITE, options);
@@ -262,7 +262,7 @@ 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 = is_http_proto(filename);
+    int http_base_proto = filename ? is_http_proto(filename) : 0;
 
     if (!http_base_proto || !hls->http_persistent || hls->key_info_file || hls->encrypt) {
         ff_format_io_close(s, pb);