From patchwork Sun Apr 21 07:57:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Zhao X-Patchwork-Id: 12849 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id E96B244905E for ; Sun, 21 Apr 2019 11:04:56 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BFA1E68A728; Sun, 21 Apr 2019 11:04:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7FAE8689A6C for ; Sun, 21 Apr 2019 11:04:50 +0300 (EEST) Received: by mail-pl1-f196.google.com with SMTP id b3so4423732plr.7 for ; Sun, 21 Apr 2019 01:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=4Tslt8eJHRwiAJ/Rr0bafM5nlDUrPJ99GLa16qTWxxA=; b=KSIG6AT7chkFjwv9UafNhhhuOlmlHh90AKK1FiAHCPGwTxIt1QzijWzze9wBOfnGhk oL+wEymy+8Na+0UBu/p5NSJET5mDtSlZwL127CCOEyrq0iAgZEHSl30gDU5W7KEMbzfs Q9jPk4rHr6fQ51/dNH0ScJXUs+uVxDsMY5ikf31SNtY72WyZkAAX23oL7JZLbzqA23ab CuC2PyK5yelTLK44h6X5HGQEE7e4VNZT07u2wcSMbhsCDjh3VcVbB6HvkVFYLPR3bFEa 4Wj9SRwaHOXIBsmbu1RZy/9+hriL0TdaGZQ1TR7fvFrsXXNVRXN92ON9QarB9k2Amd/y /Qmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=4Tslt8eJHRwiAJ/Rr0bafM5nlDUrPJ99GLa16qTWxxA=; b=bAO5fODGd7R6EYU12rugjG1I2Xhp2ogAKEU5IFMDbvPLVP7Idtr7BveNPrQjGAcM2F BdD4kiAd1XyzvCqXpeBPAmoNNZfQgdANhpsE8eFI7oDSX9G37FusMWVQzjlOLCDjON+s jWYA4s2RJ2yjIJzDKWF4GC49cOIq7Y/WwWZfefcfbSeK4TuvhFSeGzpH6DfhVXnVueRV xZELCYLY+IOhlBgiQggpPx5Z7x9qKXYeXI1cMnTwZGmWZVrUJyHh9f99PElLZMaoHHoO cUSkevb+56+uzAX7pAabdQbLr6uTgvpCRBL2JEomwkTQj5pB9bZuZzgoAus8l+aT7oK+ mR2w== X-Gm-Message-State: APjAAAUsebKwKFIWSAVKaci3DlCdILl7YSkGNeCWU+UMIEqQprCKWbqU XvlfClMo3NDiDSGoR7Ie8svW60Oc X-Google-Smtp-Source: APXvYqy7yH1DxsZ03eAnzYzHyf8id8rX7cmq97i7gw8JqwRwarPNj06ZTRqUgwniiB3IBtV2oTts/w== X-Received: by 2002:a17:902:1602:: with SMTP id g2mr13579188plg.325.1555833480802; Sun, 21 Apr 2019 00:58:00 -0700 (PDT) Received: from localhost.localdomain ([47.90.47.25]) by smtp.gmail.com with ESMTPSA id p20sm12635035pgh.83.2019.04.21.00.57.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Apr 2019 00:58:00 -0700 (PDT) From: Jun Zhao To: ffmpeg-devel@ffmpeg.org Date: Sun, 21 Apr 2019 15:57:55 +0800 Message-Id: <1555833476-22311-1-git-send-email-mypopydev@gmail.com> X-Mailer: git-send-email 1.7.1 Subject: [FFmpeg-devel] [PATCH V1 1/2] examples/avio_reading: Use avio_context_free() to free AVIOContext X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Jun Zhao MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Jun Zhao Signed-off-by: Jun Zhao --- doc/examples/avio_reading.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/examples/avio_reading.c b/doc/examples/avio_reading.c index cbfeb17..36ee02a 100644 --- a/doc/examples/avio_reading.c +++ b/doc/examples/avio_reading.c @@ -117,11 +117,12 @@ int main(int argc, char *argv[]) end: avformat_close_input(&fmt_ctx); + /* note: the internal buffer could have changed, and be != avio_ctx_buffer */ - if (avio_ctx) { + if (avio_ctx) av_freep(&avio_ctx->buffer); - av_freep(&avio_ctx); - } + avio_context_free(&avio_ctx); + av_file_unmap(buffer, buffer_size); if (ret < 0) {