From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 56090460B4 for ; Thu, 4 May 2023 23:49:36 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A336468C145; Fri, 5 May 2023 02:49:24 +0300 (EEST) 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-Google-Smtp-Source: ACHHUZ6Ts3Ze0+m9hhEGp7vMj/njQ9PpyzBNt+I+czgJdjCNgetCS+7YWoKeODIywkzZdv/sBz1T9g== 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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); -- 2.40.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".