雾聪
2023-12-19 6823fe0c82c2f929a10510ad2533f5afcc47b354
fix memory leak of FfmpegLoad
1个文件已修改
8 ■■■■ 已修改文件
runtime/onnxruntime/src/audio.cpp 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
runtime/onnxruntime/src/audio.cpp
@@ -462,6 +462,10 @@
        nullptr, // write callback (not used here)
        nullptr // seek callback (not used here)
    );
    if (!avio_ctx) {
        av_free(buf_copy);
        return false;
    }
    AVFormatContext* formatContext = avformat_alloc_context();
    formatContext->pb = avio_ctx;
    if (avformat_open_input(&formatContext, "", NULL, NULL) != 0) {
@@ -576,7 +580,9 @@
        av_packet_unref(packet);
    }
    avio_context_free(&avio_ctx);
    //avio_context_free(&avio_ctx);
    av_freep(&avio_ctx ->buffer);
    av_freep(&avio_ctx);
    avformat_close_input(&formatContext);
    avformat_free_context(formatContext);
    avcodec_free_context(&codecContext);