From patchwork Thu May 4 23:48:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 41477 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp84171pzb; Thu, 4 May 2023 16:49:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6YYqxJ9IKOoVBC7SJkQqNsHYRjxRqI1CdCR53SLIBkshd4DlyB2enXkPJvIYtnZeti7Q35 X-Received: by 2002:a17:907:26cb:b0:94e:9a73:1637 with SMTP id bp11-20020a17090726cb00b0094e9a731637mr426599ejc.75.1683244192617; Thu, 04 May 2023 16:49:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683244192; cv=none; d=google.com; s=arc-20160816; b=pChyJeKA9rmnmNz6T8To0GdeZQvQgTZx86lgOHM0cVpJ5R9dhyZdiJS+PoHVz2dt2L kcIAWd7LMGmtiwa0vclYfBEiMz5/8jEPHWfpmb7HXb2zsBuegoRpOPbtm/dD+y5y/5ac GOYbloqxJin37oGUFcjyjl7/FrVvqApC3pkvKq/XSUu8iASB+JtnTTdlLGwt6iMi6m/Z quaOR5huRinvjHLsyA2djmtLZdSiLaEHm1pHKI9Yqorg5SDDrimeDsPdz8F9GUniNcuO FWmL8EWm4yi/UGMvpw6yPXCc/LrkM8bzOPzibC7X/J3kblG6JxBxWJd3mlOpifQD8lG0 YJLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=LToTEh07whydzLOdTdR4NuQQdwAm3oLFkCLMQrvlhmI=; b=AvzAVBu63pcKlXnEcaboUzkIDsEhjtEfv6wDDrLT4iOhon33FNmxQt4wgIvsoVHe1j JKRyZ/gUe+HzBiGgA8u3BxsTzQrKQhTym0U42n32APel4/jAQL1XjCQPDdl+fiAOX1uT 28EhZH83hcp0G3Uo87XQb+AF1rEfWydZtuHr+BHUUtY7hg689W9OE80pkA4IVOSMq8oX q/SIMBwBGE27vdXjbAIBLKP476rbIEctnKXIOQnb/gbAOFm1jlG5rWpf+2JnTYnN22DP 6j9LbEmfjvp14M7F03nXPKFOiiJdrEyGop1Ko+gJnsCqcTxaXWlIuTukBW42dAJGFHCV 7chA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20221208 header.b=lynIVM5k; 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 f15-20020a170906824f00b0094ed1a56fbdsi228723ejx.902.2023.05.04.16.49.27; Thu, 04 May 2023 16:49:52 -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.s=20221208 header.b=lynIVM5k; 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 B7D6568BEF9; Fri, 5 May 2023 02:49:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6D43568BFC1 for ; Fri, 5 May 2023 02:49:17 +0300 (EEST) Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-6a60460a23dso764174a34.0 for ; Thu, 04 May 2023 16:49:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683244155; x=1685836155; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=bY/ejEl0cqPhhomNLMEcUebvuAWTlqfqqJOmgK8QgsI=; b=lynIVM5kuZO5fXUJkhM6ZWriurfb3WHKICJENjk4tauvMVZ5kKjZOXkGrYQSPFS5XW ELg5EaMyOyX5qYWpSpTxvHmFzlAZ90QvJ99qivuo5VKU6uGoxI/2/5/QMxs0E8VcDopM 64RBs30R4sK4+YyXFjY7y0HqcRBc/O1BK2Laz15bAreYhesK55aQME9oyr7uxA1/fVDW sp+i8f4nNcF6v0U0cMIRulu+2Wi1SbzwpxDZaF2R+oN3lXXy6NxYB9TIVasQ1+BrCEa8 e44WcZlktRaILbElArCb+MRLptQX+q2cVGSn3Q0RP7wZky6tjVjKAHEr/+KGD6rrEPuw iJ4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683244155; x=1685836155; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bY/ejEl0cqPhhomNLMEcUebvuAWTlqfqqJOmgK8QgsI=; b=HtuAMU2LrPMzFKptbVOw6mwo09CicwlRWiSD+Dp8n4zpQ9FlqrLi61qliexSa3Suic dJApA2s7W6FV/NZvwu+e0XN+7bVlKnT6mIQoS77PCC+B5K2GDtFetqOq1yRGZv9NJzpO Gz1Mi7gjP1FQiuJRAqOLjkP+sT67LUjxE1w5523gowoxLlGhy2sty2gZYhCnSFvL70WJ REuG35CAB7OlJ0Nxo3yif1XdKmrJ7bITYgY1YoNWX/zAujA7DcNiLw2AEDBJtplJ0wCp +cGRhagu34QFXbqg7KVwRS3MARPDWp3MLYCCuKj4Y739epvs+gmzVcDZeu00gylUPaiQ CtWg== X-Gm-Message-State: AC+VfDyeTXnpCsqJPNnhCMZ6y6wJZ4o/efkZqDAqO8R7km0N9jkr/z+w 1isFrvPB8nXsDIk7XJ4h/gmOUkxZErw= X-Received: by 2002:a05:6830:22dc:b0:6a4:1980:2a93 with SMTP id q28-20020a05683022dc00b006a419802a93mr780778otc.29.1683244154824; Thu, 04 May 2023 16:49:14 -0700 (PDT) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id e18-20020a9d7312000000b006a42b16ec7asm175128otk.38.2023.05.04.16.49.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 May 2023 16:49:14 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 4 May 2023 20:48:51 -0300 Message-Id: <20230504234852.3789-1-jamrial@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] doc/examples/transcode_aac: free the converted input samples buffer with av_free X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: EynGyYVJgYTb Fixes -Wuse-after-free warnings. Signed-off-by: James Almer --- doc/examples/transcode_aac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c index bb5681a7c0..7f4ca382b1 100644 --- a/doc/examples/transcode_aac.c +++ b/doc/examples/transcode_aac.c @@ -465,7 +465,7 @@ static int init_converted_samples(uint8_t ***converted_input_samples, fprintf(stderr, "Could not allocate converted input samples (error '%s')\n", av_err2str(error)); - av_freep(&(*converted_input_samples)[0]); + av_free((*converted_input_samples)[0]); free(*converted_input_samples); return error; } @@ -599,7 +599,7 @@ static int read_decode_convert_and_store(AVAudioFifo *fifo, cleanup: if (converted_input_samples) { - av_freep(&converted_input_samples[0]); + av_free(converted_input_samples[0]); free(converted_input_samples); } av_frame_free(&input_frame); From patchwork Thu May 4 23:48:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 41478 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp84211pzb; Thu, 4 May 2023 16:50:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4at6cxrvtZ87U2V6T9RhHrXgrTrPtOsooxDxsEm9+3SS3JZSi3+7uKuzwzNPP+HQzjUlNH X-Received: by 2002:a17:907:da0:b0:94a:8f3a:1a77 with SMTP id go32-20020a1709070da000b0094a8f3a1a77mr565663ejc.8.1683244201295; Thu, 04 May 2023 16:50:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683244201; cv=none; d=google.com; s=arc-20160816; b=XRQZqMUQEc1mZFySyvKcdpMd03cdI1aSLgQtvtEdC3JoH7fgO9J03od7UgWrVLpEf9 8lvJMCdCeIrxDOoxIyCJTNZS7E7nuwVE/o0SALr+B1CmElYqnUIT6eS3dK5zEBIxleLN OyPII92e4o4iNMXBesS6U20VHjLZeFP3TceKPVP4ROckPpalFmRfTxEQCn42yu4Skf9/ hpH2d8Dw9Ff69iH3njssaEasnLqhczcrzdLX5tlU6+nIj0beVhUk3m+6FlJyhkWkh5xx K0YCohlXY3yN8XmZiNnw90eNchZhE0m+LtxriCZBIu8VB40/uZjCkKBuWiiXlR9iledq MC1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=wLqIbRLHVNYZdTLy81VxFRHZXyHRxHtCr5zU2nL3Vvs=; b=cZyrSWfkobel/MjYE69uaerD6X7IIw/utC7753uShe1wnywJ1telapTKvyusBsb6vT KXF+1P0EeiFWqtIpJPeHNZJ4gQzPwqlzdpE0jQWoHugNCgWn9Ucye0uh4XXuoaxseNp1 L4a5Oln8M2SwN/7itEZX55LUwibe/LVkM+QheKa9lFeySi6mF8sNGaMsenk9uQ3+3N8t vTdPuhFdJhX7/DDqW4VXDbE2OyhC2v5QE/7+trvDmKiCZRqdW7MiqaEJrZ1oCUi6G8nn K1URBgZmQZZ+sVROYeSYwa9ETirBlsOJ7qcDdj6s9VDwdD44MNlrQTfdyByUboLj/yl2 Pg4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20221208 header.b="n3Gjq+/1"; 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 q18-20020a1709066ad200b009584c5bcbc6si233201ejs.823.2023.05.04.16.49.38; Thu, 04 May 2023 16:50:01 -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.s=20221208 header.b="n3Gjq+/1"; 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 D00F668BFC1; Fri, 5 May 2023 02:49:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oa1-f54.google.com (mail-oa1-f54.google.com [209.85.160.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 69B0B68C13A for ; Fri, 5 May 2023 02:49:18 +0300 (EEST) Received: by mail-oa1-f54.google.com with SMTP id 586e51a60fabf-192814aa343so977640fac.1 for ; Thu, 04 May 2023 16:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683244156; x=1685836156; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=4FS8VYzAA//sKqeo1x6Ta8R4kZkUVc9jgpEYylhu46o=; b=n3Gjq+/1X0EpXbsulzfMksGTw6apGmC1IWa74lr4O9JrxCugAdLo9pmwmvfLW4nYxN qAwtSvy9w2jMNYQRMxtM7FPjh27smFyTS/BdT0ixT61xyOzkHD/oX1+aoJKcQYofeNBu 9aGgd4F4RkjfA9qgL0mcQLFyiy2ZANZB/8ue4MGWWv1Gg4eb+YvdT+ZFKfMrCSTSLZRE kY20rs9/6n+TsYwu2Eg3DvbntZ9mPemKKdOgDxyaGqkW2fBrz04wPCrk6bROXAn3fp9Y lUf1uYB6RUu5xcDzAufyFydk23bCQmGzgJCdL1rME2380Od8dWoi+lBue+O4cWjEgEND Ldqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683244156; x=1685836156; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4FS8VYzAA//sKqeo1x6Ta8R4kZkUVc9jgpEYylhu46o=; b=MrOfCDdkWcUkv6z75WYmt0mcqb04mpkmxlfZLlmjRsyeiehgekJsNS1bUIte5Djw2R /P+2w6Hx+bVx5fK80HzYBjOvWT/i+4rAqsGXgMR9AhrGzL5Jj4WJSvcltMC4K7pAD6tb CfWWpvd+ixlYarHqbAciAawT7uHNTBifzFx4/vEqm5sTKYyQwg3NMYMVO6kAieDR+LH0 Rlxxad7iHBbORM1bXvRWzuyo1GUkOtBuhksZjyfUn0MKZoH0L+9iihJH61h9wXX7QdXF EsB8/9jLpTD/+rivXF9WR+XpxV74xX7taUF2sf6Qpyw8gD21u4wVMeW57OGdAeTEEsbL IEmQ== X-Gm-Message-State: AC+VfDx3/QitXR3xaR1pxWYxh0IQtXtvVpR6K5LWjj02zq/s8xPXhX5V l2UkN0iU7ykPXAlDOTxMbdi0GFTogj8= X-Received: by 2002:a05:6870:b7a5:b0:184:64eb:d688 with SMTP id ed37-20020a056870b7a500b0018464ebd688mr1878451oab.22.1683244156387; Thu, 04 May 2023 16:49:16 -0700 (PDT) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id e18-20020a9d7312000000b006a42b16ec7asm175128otk.38.2023.05.04.16.49.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 May 2023 16:49:15 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 4 May 2023 20:48:52 -0300 Message-Id: <20230504234852.3789-2-jamrial@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230504234852.3789-1-jamrial@gmail.com> References: <20230504234852.3789-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] doc/examples/transcode_aac: use av_calloc to allocate the array of input samples buffer pointers X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 1c+qAmwUpH/C Signed-off-by: James Almer --- doc/examples/transcode_aac.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c index 7f4ca382b1..eddb3b203d 100644 --- a/doc/examples/transcode_aac.c +++ b/doc/examples/transcode_aac.c @@ -450,8 +450,8 @@ static int init_converted_samples(uint8_t ***converted_input_samples, * Each pointer will later point to the audio samples of the corresponding * channels (although it may be NULL for interleaved formats). */ - if (!(*converted_input_samples = calloc(output_codec_context->ch_layout.nb_channels, - sizeof(**converted_input_samples)))) { + if (!(*converted_input_samples = av_calloc(output_codec_context->ch_layout.nb_channels, + sizeof(**converted_input_samples)))) { fprintf(stderr, "Could not allocate converted input sample pointers\n"); return AVERROR(ENOMEM); } @@ -465,8 +465,9 @@ static int init_converted_samples(uint8_t ***converted_input_samples, fprintf(stderr, "Could not allocate converted input samples (error '%s')\n", av_err2str(error)); + av_free((*converted_input_samples)[0]); - free(*converted_input_samples); + av_freep(converted_input_samples); return error; } return 0; @@ -600,7 +601,7 @@ static int read_decode_convert_and_store(AVAudioFifo *fifo, cleanup: if (converted_input_samples) { av_free(converted_input_samples[0]); - free(converted_input_samples); + av_free(converted_input_samples); } av_frame_free(&input_frame);