summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-03-21 13:54:13 -0700
committerChris Robinson <[email protected]>2012-03-21 13:54:13 -0700
commit5a43cd3b64664d891888a93bc120c6650b73ccd5 (patch)
tree4da8a480aa219090e882bbb757e52b05bc6bf640 /examples
parent5d08563975ff07696f4e0ac184d7a0f74f70dbc6 (diff)
Use avformat_free_context to free a format context that failed to open
Diffstat (limited to 'examples')
-rw-r--r--examples/alffmpeg.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/examples/alffmpeg.c b/examples/alffmpeg.c
index ed4c46e0..903d85ee 100644
--- a/examples/alffmpeg.c
+++ b/examples/alffmpeg.c
@@ -205,8 +205,12 @@ FilePtr openAVData(const char *name, char *buffer, size_t buffer_len)
{
if(avformat_find_stream_info(file->FmtCtx, NULL) >= 0)
return file;
+ av_close_input_file(file->FmtCtx);
+ file->FmtCtx = NULL;
}
- av_close_input_file(file->FmtCtx);
+ if(file->FmtCtx)
+ avformat_free_context(file->FmtCtx);
+ file->FmtCtx = NULL;
}
free(file);
@@ -236,8 +240,12 @@ FilePtr openAVCustom(const char *name, void *user_data,
{
if(avformat_find_stream_info(file->FmtCtx, NULL) >= 0)
return file;
+ av_close_input_file(file->FmtCtx);
+ file->FmtCtx = NULL;
}
- av_close_input_file(file->FmtCtx);
+ if(file->FmtCtx)
+ avformat_free_context(file->FmtCtx);
+ file->FmtCtx = NULL;
}
free(file);