diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 2194597715..b944625b14 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -1857,7 +1857,11 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa end: - if (context && context->fc) { + if (!context) { + return status; + } + + if (context->fc) { mod_avformat_destroy_output_context(context); }