aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/hlsenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-09-03 11:18:10 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-09-03 11:28:29 +0200
commit4cad4bd4ca6add29562efcd0fb447c1973a0e1ce (patch)
tree6b926ff7a929be24cb9c8fad37da64259ce95896 /libavformat/hlsenc.c
parente3d8504fd043bdc2535525128b158fbc1fb18c67 (diff)
downloadffmpeg-4cad4bd4ca6add29562efcd0fb447c1973a0e1ce.tar.gz
avformat/hlsenc: Fix memleak of path
Fixes: CID1322343 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/hlsenc.c')
-rw-r--r--libavformat/hlsenc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 861faf9dee..d7bb0c1031 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -120,7 +120,8 @@ static int hls_delete_old_segments(HLSContext *hls) {
HLSSegment *segment, *previous_segment = NULL;
float playlist_duration = 0.0f;
int ret = 0, path_size, sub_path_size;
- char *dirname = NULL, *p, *path, *sub_path;
+ char *dirname = NULL, *p, *sub_path;
+ char *path = NULL;
segment = hls->segments;
while (segment) {
@@ -182,7 +183,7 @@ static int hls_delete_old_segments(HLSContext *hls) {
av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: %s\n",
sub_path, strerror(errno));
}
- av_free(path);
+ av_freep(&path);
av_free(sub_path);
previous_segment = segment;
segment = previous_segment->next;
@@ -190,6 +191,7 @@ static int hls_delete_old_segments(HLSContext *hls) {
}
fail:
+ av_free(path);
av_free(dirname);
return ret;