@@ -487,8 +487,11 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls,
int ret = 0, path_size, sub_path_size;
int segment_cnt = 0;
char *dirname = NULL, *sub_path;
+ char *dirname_r = NULL;
+ char *r_dirname = NULL;
char *path = NULL;
char *vtt_dirname = NULL;
+ char *vtt_dirname_r = NULL;
AVDictionary *options = NULL;
AVIOContext *out = NULL;
const char *proto = NULL;
@@ -517,7 +520,7 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls,
}
if (segment && !hls->use_localtime_mkdir) {
- char *dirname_r = hls->segment_filename ? av_strdup(hls->segment_filename): av_strdup(vs->avf->url);
+ dirname_r = hls->segment_filename ? av_strdup(hls->segment_filename): av_strdup(vs->avf->url);
dirname = (char*)av_dirname(dirname_r);
}
@@ -537,7 +540,6 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls,
}
}
- av_freep(&dirname);
dirname = r_dirname;
}
@@ -573,7 +575,7 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls,
}
if ((segment->sub_filename[0] != '\0')) {
- char *vtt_dirname_r = av_strdup(vs->vtt_avf->url);
+ vtt_dirname_r = av_strdup(vs->vtt_avf->url);
vtt_dirname = (char*)av_dirname(vtt_dirname_r);
sub_path_size = strlen(segment->sub_filename) + 1 + strlen(vtt_dirname);
sub_path = av_malloc(sub_path_size);
@@ -608,8 +610,9 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls,
fail:
av_freep(&path);
- av_freep(&dirname);
- av_freep(&vtt_dirname);
+ av_freep(&dirname_r);
+ av_freep(&r_dirname);
+ av_freep(&vtt_dirname_r);
return ret;
}