If av_exit() was called after an AVFormatContext was created, but before
its file was opened, av_exit() would pass a NULL pointer to url_fclose().
Originally committed as revision 12915 to svn://svn.ffmpeg.org/ffmpeg/trunk
/* maybe av_close_output_file ??? */
AVFormatContext *s = output_files[i];
int j;
- if (!(s->oformat->flags & AVFMT_NOFILE))
+ if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
url_fclose(s->pb);
for(j=0;j<s->nb_streams;j++) {
av_free(s->streams[j]->codec);