avformat/hlsenc: fix memleak problem about fmp4_init_filename
move fmp4_init_filename init in if else for first fmp4_init_filename set value operation. Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
This commit is contained in:
parent
10a0436dca
commit
c608669264
@ -2576,6 +2576,13 @@ static int hls_init(AVFormatContext *s)
|
||||
if (hls->segment_type == SEGMENT_TYPE_FMP4) {
|
||||
if (hls->nb_varstreams > 1)
|
||||
fmp4_init_filename_len += strlen(POSTFIX_PATTERN);
|
||||
if (hls->flags & HLS_SINGLE_FILE) {
|
||||
vs->fmp4_init_filename = av_strdup(vs->basename);
|
||||
if (!vs->fmp4_init_filename) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
vs->fmp4_init_filename = av_malloc(fmp4_init_filename_len);
|
||||
if (!vs->fmp4_init_filename ) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
@ -2609,6 +2616,7 @@ static int hls_init(AVFormatContext *s)
|
||||
av_strlcpy(vs->base_output_dirname, vs->fmp4_init_filename,
|
||||
fmp4_init_filename_len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hls->use_localtime) {
|
||||
@ -2663,13 +2671,6 @@ static int hls_init(AVFormatContext *s)
|
||||
}
|
||||
}
|
||||
|
||||
if ((hls->flags & HLS_SINGLE_FILE) && (hls->segment_type == SEGMENT_TYPE_FMP4)) {
|
||||
vs->fmp4_init_filename = av_strdup(vs->basename);
|
||||
if (!vs->fmp4_init_filename) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
if ((ret = hls_mux_init(s, vs)) < 0)
|
||||
goto fail;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user