From patchwork Sun Jun 11 14:05:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Rothenpieler X-Patchwork-Id: 3914 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.10.195 with SMTP id 186csp512334vsk; Sun, 11 Jun 2017 07:07:23 -0700 (PDT) X-Received: by 10.223.163.89 with SMTP id d25mr4748684wrb.98.1497190043707; Sun, 11 Jun 2017 07:07:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497190043; cv=none; d=google.com; s=arc-20160816; b=0H19Jswx8xhuOY2d7f6VTXi8AB59gQ0qvplqU5IJqJOB2T18CYgGBO9CfuF+fWcfE0 VRAVMgEmPqDwwwN/HEKC2oO1VwrEFY5XoaHM2I3icmpLlFASMLrxygYz7M41mctO6ibv ptAvTyYDqv2r3Nr4MroXg/a7SE8+IghFiSQkm8W0w/uoL04sxrO/H1azoIrS+HKLDjRP wY64fQMPzo5UBy6H5l2lHJxrF30ZWJSykauHndbOi4oci6QJKcngoM9XiWrtOIBqji+D LlBFpoXh3/JmAiXjaRPf6Jo93PDbVuCD0KLYqj4Hh8ivcDI9kSoTJTICR6U8c/n+kCuC WHcg== 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:cc: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=FrmcWIo9qVMhu4OENNzfCaNXECusEkNrmHESGbZuD4o=; b=wVgjCmEpIw+gM6lFu5qeZ1tLWqQ9vR6fTmjHnsBt1D8OgYiLIeI9DAbfPnW0FVYEd0 LPd9LfwSds1zWJwoHJ69voLuaWcs8Fc3bpv2l2MxYKigqkz2WqKMERuXdV2igSs0KNeu AIQAoUuFFhlgJui+v3bk45aNpioo31G2GwBCAluZh8K71idugP6C6fN60Cwpy3BAW8cj XlCRYpy9kWYvuCzFIttWM5kJKnBPvjVg7e2DPSLsJkZATlZ4TNgbjfwEtxXjNiwuvNXk ljz6fX2alBNGXeZLdjPqfXu3zT15o2LoOpR8Se4civofmGHCWpDoE2SG2aFJXFozecBq PMXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q11si6076470wra.189.2017.06.11.07.07.23; Sun, 11 Jun 2017 07:07:23 -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=@rothenpieler.org; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2B7C6688262; Sun, 11 Jun 2017 17:06:11 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from btbn.de (btbn.de [5.9.118.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 29BF3689D8F for ; Sun, 11 Jun 2017 17:06:07 +0300 (EEST) Received: from localhost.localdomain (unknown [IPv6:2a02:8109:43f:959c:ba97:5aff:fe10:ec69]) by btbn.de (Postfix) with ESMTPSA id 7ACC26A521; Sun, 11 Jun 2017 16:06:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rothenpieler.org; s=mail; t=1497189963; bh=aVXfZp7d/7QZSwpD50NADJTOIeWn5UuW7lHi+GjWOkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HxREtJ40yvxMComshGAniIyGn28OmC6YrJ37MAZLDjx7tQlTzOLxc55smft6i42dE tECO5ivLfz2Bne+VbuaPEeJ6XH22zKgE76RS/MxIgjuivaNjctIS4WiIDE3uqaoE1R efixpb9zNs6bAN8PDPFaevDK3QyVnRIu32kqbNbI= From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Sun, 11 Jun 2017 16:05:49 +0200 Message-Id: <20170611140551.11844-7-timo@rothenpieler.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170611140551.11844-1-timo@rothenpieler.org> References: <20170611140551.11844-1-timo@rothenpieler.org> Subject: [FFmpeg-devel] [PATCH 07/11] avfilter/vf_signature: fix memory leaks in error cases 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: Timo Rothenpieler MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes CIDs 1403234 and 1403235 --- libavfilter/vf_signature.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c index 06b1b910d4..f0078ba1a6 100644 --- a/libavfilter/vf_signature.c +++ b/libavfilter/vf_signature.c @@ -260,8 +260,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref) if (!elemsignature) return AVERROR(ENOMEM); sortsignature = av_malloc_array(elemcat->elem_count, sizeof(int64_t)); - if (!sortsignature) + if (!sortsignature) { + av_freep(&elemsignature); return AVERROR(ENOMEM); + } for (j = 0; j < elemcat->elem_count; j++) { blocksum = 0; @@ -508,6 +510,7 @@ static int binary_export(AVFilterContext *ctx, StreamContext *sc, const char* fi char buf[128]; av_strerror(err, buf, sizeof(buf)); av_log(ctx, AV_LOG_ERROR, "cannot open file %s: %s\n", filename, buf); + av_freep(&buffer); return err; } init_put_bits(&buf, buffer, len);