From patchwork Tue Mar 6 04:42:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 7820 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.181.170 with SMTP id m39csp3322121jaj; Mon, 5 Mar 2018 20:43:09 -0800 (PST) X-Google-Smtp-Source: AG47ELuHAxOc5CorAEzDw3D+0dy0C4eQtWZ4MQB6jUP51E7vqVV/fQRdF7I+P4v/7mxQ6FX4DVIn X-Received: by 10.28.231.6 with SMTP id e6mr10740538wmh.51.1520311389880; Mon, 05 Mar 2018 20:43:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520311389; cv=none; d=google.com; s=arc-20160816; b=X6xYLrO6pgddqAm7Dy+D15mwLVJri2szEdHoNBHIN2XQHL5i/pYV9EMbPH3RYiewqy M9upELoFeps+BPWDahjoKssr+hoOiyU8l+kaRlXX2eHQzbTcleclY4Va+bRXwwog9KBe rDeb6X7Mg75zMGDqO62GoooUcZxQcHFY58qWcglwqTzm5NNMEnS7ihSVISydMcZi0iWs Ct8BVI2kqXhILTLnDY4s8Y7cPtHsY6jbyokuTeZjjWgNyYOGcoj44vzWDISjVeAff4BK jgBGN1Wwaa+AinrCHN61X8aazvogP3Cc7cfM7gPCdDxRCpYouIDkE13ViX4LJJOaxJlK XtUg== 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:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=xOq2WxUjg5bVBm5jcpKz6ZTICm5oHOlEV/zeHWgaeeQ=; b=H5cmtYQlEG8jN2M1u46xB138ud//QZjmqC5dn3/1YhqddJhU4QcrGLb+hx7qAcQFn2 katgoXXQpobpPwDwzN7nGlU0rnDeFqvMJMr8lTYJyoyyTGWr8av9ptNnVUQCQVSRzx36 MZIY1TgD0CLvm6K/yCMWnGGzKp/bhd0WRQH4yQ0PBPAJO3BXWEumrhRYboCn4Kjz/Qmk CZkF9PrQH8KtfhWr8mtCyE1p65JTia9A2nv91CuSLMsunn8xoC/xd9hMeW0ZNen+cdis MnJL40AG200Lz6NN3uKfwnUa9eR6V+x7DhsALKRIzygs2+zudtfMBpH+nZD3Vhy28ngV fm1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=Xqc3icA0; 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=QUARANTINE 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 u61si1650154wrb.232.2018.03.05.20.43.09; Mon, 05 Mar 2018 20:43:09 -0800 (PST) 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.s=20161025 header.b=Xqc3icA0; 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=QUARANTINE 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 C1CB968A415; Tue, 6 Mar 2018 06:43:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-vk0-f66.google.com (mail-vk0-f66.google.com [209.85.213.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 55AC068A399 for ; Tue, 6 Mar 2018 06:42:54 +0200 (EET) Received: by mail-vk0-f66.google.com with SMTP id s1so11502176vke.5 for ; Mon, 05 Mar 2018 20:43:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=f1i6ONNoD+gk0Qzzs2dbzUq6IkvziHh2Nu63DQMQZ50=; b=Xqc3icA0XnUsZNRQzNBBO+PUNjk6A1jbtBOEfs+5ZLfAtcLCILlQLFhpcrRUXJYREG WY+wRPXH3s0PlUvakekU8xJFHwInrwOJ/EFcq+pZ48qTUml3duHmhJMQ9PRsdpsux+b3 7r1ygeMTP7cgLI3GNLfw3nx++Tdqt2wu/WI87r6TtCclHqcwQTR9AQY5cqTertxwgIIz n9HWXeDm2hBsoj7Nh+xmRidKr19b9Q+tlfI77VtAyC6JbpVCjEVkK9sLJn2hSLU/YB4r RZ/VC/pk97puMvtmY0gu1ufccK/X1hPedXbfMuW2/QZsrdfvUYTFPGGDigiKo6mh33VG T2Ng== 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; bh=f1i6ONNoD+gk0Qzzs2dbzUq6IkvziHh2Nu63DQMQZ50=; b=dK5Nz3O3mz36BwBxT/e9OD+ULhFHDDz002gM223pBuNObaYWmUVSyLEACo3yE42GFi eSL8TuTYw+qbMEebSlbbUs8sykjJfGQzaYkNe2ENsCMXbs1AWm6gA4ek2x8AHhlrgB89 wCf7vPGjJ5P6amBhhDoGKm1YC+0lBTtcgaUWVT7k+3XcJAFvY71uVt3EjRET2EkCfg7d TRdyKBl9youqoIp7xXiIcYISvCk+30Ew2TQdBhn9FHlNvXDey9cWxCA176baXdzNp3VW 8tIB35AHi0astG1kMzR1otclP7Zr3vqbTNyWgiCYgz5p8BTg0LzHOzVgNVmuTbWoYgvL MnoQ== X-Gm-Message-State: APf1xPD8UBiAc1aUk9i3TFe04DIvl5rE1LL+40H3xMXLUBsc+UB/zARi /jl8SW97liecWItVAwmlOOehAWto X-Received: by 10.31.134.147 with SMTP id i141mr12023970vkd.128.1520311380472; Mon, 05 Mar 2018 20:43:00 -0800 (PST) Received: from localhost.localdomain ([190.188.171.140]) by smtp.gmail.com with ESMTPSA id 34sm6383274uaq.39.2018.03.05.20.42.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 20:42:59 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Tue, 6 Mar 2018 01:42:36 -0300 Message-Id: <20180306044237.10388-1-jamrial@gmail.com> X-Mailer: git-send-email 2.16.2 Subject: [FFmpeg-devel] [PATCH 1/2] avformat/utils: free existing extradata before trying to allocate a new one 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" This prevents leaks in the rare cases the function is called when extradata already exists. Signed-off-by: James Almer --- libavformat/utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index 72531d4185..31340a484b 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3245,6 +3245,7 @@ int ff_alloc_extradata(AVCodecParameters *par, int size) { int ret; + av_freep(&par->extradata); if (size < 0 || size >= INT32_MAX - AV_INPUT_BUFFER_PADDING_SIZE) { par->extradata = NULL; par->extradata_size = 0;