avformat/hlsenc: fix baseurl missing last char
authorRobert Nagy <ronag89@gmail.com>
Mon, 4 Dec 2017 04:00:13 +0000 (12:00 +0800)
committerSteven Liu <lq@chinaffmpeg.org>
Mon, 4 Dec 2017 04:00:13 +0000 (12:00 +0800)
Reviewed-by: Steven Liu <lq@onvideo.cn>
libavformat/hlsenc.c

index cdfbf45..dc8bf48 100644 (file)
@@ -1921,14 +1921,11 @@ static int hls_write_header(AVFormatContext *s)
     }
 
     if (hls->baseurl) {
-        int baseurl_len;
-        baseurl_len = strlen(hls->baseurl);
-        vs->baseurl = av_malloc(baseurl_len);
+        vs->baseurl = av_strdup(hls->baseurl);
         if (!vs->baseurl) {
             ret = AVERROR(ENOMEM);
             goto fail;
         }
-        av_strlcpy(vs->baseurl, hls->baseurl, baseurl_len);
     }
 
     if ((hls->flags & HLS_SINGLE_FILE) && (hls->segment_type == SEGMENT_TYPE_FMP4)) {