Revision 42f97696

View differences:

ffmpeg.c
515 515

  
516 516
    /* close files */
517 517
    for(i=0;i<nb_output_files;i++) {
518
        /* maybe av_close_output_file ??? */
519 518
        AVFormatContext *s = output_files[i];
520 519
        int j;
521 520
        if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
522 521
            url_fclose(s->pb);
523
        for(j=0;j<s->nb_streams;j++) {
524
            av_metadata_free(&s->streams[j]->metadata);
525
            av_free(s->streams[j]->codec);
526
            av_free(s->streams[j]->info);
527
            av_free(s->streams[j]);
528
        }
529
        for(j=0;j<s->nb_programs;j++) {
530
            av_metadata_free(&s->programs[j]->metadata);
531
        }
532
        for(j=0;j<s->nb_chapters;j++) {
533
            av_metadata_free(&s->chapters[j]->metadata);
534
        }
535
        av_metadata_free(&s->metadata);
536
        av_free(s);
522
        avformat_free_context(s);
537 523
        av_free(output_streams_for_file[i]);
538 524
    }
539 525
    for(i=0;i<nb_input_files;i++) {
libavformat/movenchint.c
81 81
        url_close_dyn_buf(track->rtp_ctx->pb, &buf);
82 82
        av_free(buf);
83 83
    }
84
    if (track->rtp_ctx && track->rtp_ctx->streams[0]) {
85
        av_metadata_free(&track->rtp_ctx->streams[0]->metadata);
86
        av_free(track->rtp_ctx->streams[0]->codec->extradata);
87
        av_free(track->rtp_ctx->streams[0]->codec);
88
        av_free(track->rtp_ctx->streams[0]->info);
89
        av_free(track->rtp_ctx->streams[0]);
90
    }
91 84
    if (track->rtp_ctx) {
92
        av_metadata_free(&track->rtp_ctx->metadata);
93
        av_free(track->rtp_ctx->priv_data);
94
        av_freep(&track->rtp_ctx);
85
        avformat_free_context(track->rtp_ctx);
86
        track->rtp_ctx = NULL;
95 87
    }
96 88
    av_freep(&track->enc);
97 89
    /* Set a default timescale, to avoid crashes in dump_format */
......
488 480
        url_close_dyn_buf(rtp_ctx->pb, &ptr);
489 481
        av_free(ptr);
490 482
    }
491
    av_metadata_free(&rtp_ctx->streams[0]->metadata);
492
    av_metadata_free(&rtp_ctx->metadata);
493
    av_free(rtp_ctx->streams[0]->codec->extradata);
494
    av_free(rtp_ctx->streams[0]->codec);
495
    av_free(rtp_ctx->streams[0]->info);
496
    av_free(rtp_ctx->streams[0]);
497
    av_freep(&rtp_ctx);
483
    avformat_free_context(rtp_ctx);
498 484
}
499 485

  
libavformat/rtpenc_chain.c
66 66
            url_close_dyn_buf(rtpctx->pb, &ptr);
67 67
            av_free(ptr);
68 68
        }
69
        av_free(rtpctx->streams[0]->codec->extradata);
70
        av_free(rtpctx->streams[0]->codec);
71
        av_free(rtpctx->streams[0]->info);
72
        av_free(rtpctx->streams[0]);
73
        av_free(rtpctx);
69
        avformat_free_context(rtpctx);
74 70
        return NULL;
75 71
    }
76 72

  
libavformat/rtsp.c
498 498
                } else {
499 499
                    url_fclose(rtpctx->pb);
500 500
                }
501
                av_metadata_free(&rtpctx->streams[0]->metadata);
502
                av_metadata_free(&rtpctx->metadata);
503
                av_free(rtpctx->streams[0]->codec->extradata);
504
                av_free(rtpctx->streams[0]->codec);
505
                av_free(rtpctx->streams[0]->info);
506
                av_free(rtpctx->streams[0]);
507
                av_free(rtpctx);
501
                avformat_free_context(rtpctx);
508 502
            } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)
509 503
                ff_rdt_parse_close(rtsp_st->transport_priv);
510 504
            else if (CONFIG_RTPDEC)
libavformat/sapenc.c
46 46
            continue;
47 47
        av_write_trailer(rtpctx);
48 48
        url_fclose(rtpctx->pb);
49
        av_metadata_free(&rtpctx->streams[0]->metadata);
50
        av_metadata_free(&rtpctx->metadata);
51
        av_free(rtpctx->streams[0]->codec->extradata);
52
        av_free(rtpctx->streams[0]->codec);
53
        av_free(rtpctx->streams[0]->info);
54
        av_free(rtpctx->streams[0]);
55
        av_free(rtpctx);
49
        avformat_free_context(rtpctx);
56 50
        s->streams[i]->priv_data = NULL;
57 51
    }
58 52

  

Also available in: Unified diff