From patchwork Mon Jul 24 19:46:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: foo86 X-Patchwork-Id: 4449 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp4615678vsb; Mon, 24 Jul 2017 12:47:58 -0700 (PDT) X-Received: by 10.223.134.26 with SMTP id 26mr14244287wrv.268.1500925678706; Mon, 24 Jul 2017 12:47:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500925678; cv=none; d=google.com; s=arc-20160816; b=pMOduN3iONL6bC7a+LzEyu2tvQWqXJs3+OWS4I9Bmof4tmCfGdIkOgVv0aXFAaP9Ut QsFoBF1nWqWL4PX6hWkLgxypHSK7V+IS5LuTaXpOD9RP5rX03rD1L1Lg8eTwd21LantK qtz8t5l8cE/zRzMJ4/k0vU7gtHtT+hcngcS744Yz1bixt1LfWXhpMfcHk1nlOBqhOIRJ dWel/6NbhbXTkZ1EgIY82BmOckUXUgRMhlValL6VhzRsrJlfKFCsZCbGECCkOeuU9Z2s 0CsfSrlvyo5A7zSUZMXI5grVdN/AmUtzpDtANY+CxTMs4RYceOl8zV0RPH/YZ6caw8Q2 5tYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=kJAdfDds/M20S1uFUGoxuvn2cNuqMFvo6ZmpqYM5hgA=; b=r6zegmvganYz6IkAd1zUcER5hbxf9h5hpPpy8poTXE8YoWntGXfEtJ2AD7CB91gm+0 pcs0cLaRP2KqM3Gp4CmFA1YU8F5cOPnIZVfp5S7o1U7dK16QXqtXgbzoZEipMPNQdwZd LZ9OjR1ZKZWnfDJLWa4IjZseON3pREj47QSHNrDIWJrm2bGOWvIg3phQ8PJeigiS6lo9 H751KPtwvqmh4ekHd34pqvLKj1R3Qs0R+rhRKc/dBlFdRgBChV9G+SFq+m6WMavowjOr c+d5OJWaymi28WihYGL7SXqeJ1b2Wzfdbeh/vB0f1wHSGkmernAeUQgzfN8olCN+qS3S wyMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=QbMv2zqe; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id c4si14076157wra.183.2017.07.24.12.47.57; Mon, 24 Jul 2017 12:47:58 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=QbMv2zqe; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9119C689B3C; Mon, 24 Jul 2017 22:47:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B2D4A6809D3 for ; Mon, 24 Jul 2017 22:47:39 +0300 (EEST) Received: by mail-lf0-f48.google.com with SMTP id g25so44590748lfh.1 for ; Mon, 24 Jul 2017 12:47:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=RPOljSPSGeLAAyurUJ5wm3bLoIc5wXqZRwTA/A7IDfY=; b=QbMv2zqe/sj7Poao1OUtk80pejj0s5G2jvbGLP/xKJRLHP4KizI7ukTnzpAl3h3srp 8e/Qhzo8NGtFVMhQTgJuYMXAdqIopCbq8a9vKdzMkPEcw0XQ0Xshfkbrf65v+KlSW51v o/MKEnvK0h//6H/LZW8xh5VwMwpXP7cPHqodhcsdNSP919z81cQUe4ZwJn2a1IILHonP ngd3XlJ1SM3I8EDsui19AiVnVrQjez9HH6bSoV3MkCK2/GSGZ2LipxTy9Tp12DNrxu78 eALRFLAHlswHE3svnkW3LOzAjPpocUZfBQmdYbNJJ+gH8SoarFENpm/6rIGVUB7Nokru 4qZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=RPOljSPSGeLAAyurUJ5wm3bLoIc5wXqZRwTA/A7IDfY=; b=TmSm5yTH0rrAFqwo8zEQtzWK/PL4j9PT7Fz+90+HfF/x6Bea3vkSGMbxGtVa/WdIUJ 28KK7Jx45QyQDBSDTHTnfs56liRAcPE4jUK6OY2pP44r2sLXG+pyXKe8IK37ipebylPE GS6XhoHVFPDZpWCs0iHiRzhZvXkRAwNkY+MZXRIOoaW5jqQDUFWfV9R9wxY4nDzSF6jv qgJdYuHfppZZdi9pSklWuOy2+dqqLwMww86GSpCkCA+jMHXem0RPqr99Yysw9Ofn9hj3 wvJUrcBrtFrTip4dLFN4NbEK0mtZqrzLaheA0GmdVEAcvGPpnfZ6mLD8y38BHeAeM6db jE4g== X-Gm-Message-State: AIVw110BY8rWI0GTp8DDFTJ0CzPNE2PccLOs2Q8/kRQ/nwMaDaNaZK5m lCTqgnRis2gVQQ31 X-Received: by 10.25.31.213 with SMTP id f204mr5553818lff.58.1500925668577; Mon, 24 Jul 2017 12:47:48 -0700 (PDT) Received: from foohost.foodomain ([2001:470:28:661::4]) by smtp.gmail.com with ESMTPSA id 25sm2522103ljn.10.2017.07.24.12.47.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jul 2017 12:47:47 -0700 (PDT) From: foo86 To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Jul 2017 22:46:33 +0300 Message-Id: <20170724194633.11925-1-foobaz86@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170724122447.3307-1-foobaz86@gmail.com> References: <20170724122447.3307-1-foobaz86@gmail.com> Subject: [FFmpeg-devel] [PATCH] avcodec/dcaenc: fix memory leaks on init failure 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavcodec/dcaenc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c index 37095674f5..1740c16432 100644 --- a/libavcodec/dcaenc.c +++ b/libavcodec/dcaenc.c @@ -145,8 +145,8 @@ static int subband_bufer_alloc(DCAEncContext *c) static void subband_bufer_free(DCAEncContext *c) { - int32_t *bufer = c->subband[0][0] - DCA_ADPCM_COEFFS; - av_freep(&bufer); + if (c->subband[0][0]) + av_free(c->subband[0][0] - DCA_ADPCM_COEFFS); } static int encode_init(AVCodecContext *avctx) @@ -1298,4 +1298,5 @@ AVCodec ff_dca_encoder = { 0 }, .defaults = defaults, .priv_class = &dcaenc_class, + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, };