Commit e2404096 authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/segment: Clear contexts after deallocation

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 2a741bae
...@@ -357,7 +357,7 @@ static int segment_end(AVFormatContext *s, int write_trailer, int is_last) ...@@ -357,7 +357,7 @@ static int segment_end(AVFormatContext *s, int write_trailer, int is_last)
av_freep(&entry); av_freep(&entry);
} }
avio_close(seg->list_pb); avio_closep(&seg->list_pb);
if ((ret = segment_list_open(s)) < 0) if ((ret = segment_list_open(s)) < 0)
goto end; goto end;
for (entry = seg->segment_list_entries; entry; entry = entry->next) for (entry = seg->segment_list_entries; entry; entry = entry->next)
...@@ -375,7 +375,7 @@ static int segment_end(AVFormatContext *s, int write_trailer, int is_last) ...@@ -375,7 +375,7 @@ static int segment_end(AVFormatContext *s, int write_trailer, int is_last)
seg->segment_count++; seg->segment_count++;
end: end:
avio_close(oc->pb); avio_closep(&oc->pb);
return ret; return ret;
} }
...@@ -688,7 +688,7 @@ static int seg_write_header(AVFormatContext *s) ...@@ -688,7 +688,7 @@ static int seg_write_header(AVFormatContext *s)
} }
if (ret < 0) { if (ret < 0) {
avio_close(oc->pb); avio_closep(&oc->pb);
goto fail; goto fail;
} }
seg->segment_frame_count = 0; seg->segment_frame_count = 0;
...@@ -849,7 +849,7 @@ static int seg_write_trailer(struct AVFormatContext *s) ...@@ -849,7 +849,7 @@ static int seg_write_trailer(struct AVFormatContext *s)
} }
fail: fail:
if (seg->list) if (seg->list)
avio_close(seg->list_pb); avio_closep(&seg->list_pb);
av_dict_free(&seg->format_options); av_dict_free(&seg->format_options);
av_opt_free(seg); av_opt_free(seg);
...@@ -865,6 +865,7 @@ fail: ...@@ -865,6 +865,7 @@ fail:
} }
avformat_free_context(oc); avformat_free_context(oc);
seg->avf = NULL;
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment