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 CDB2541267 for ; Tue, 11 Apr 2023 21:21:31 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1CF9B68BBE3; Wed, 12 Apr 2023 00:21:11 +0300 (EEST) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 02B12680A4D for ; Wed, 12 Apr 2023 00:21:03 +0300 (EEST) Received: by mail-lj1-f176.google.com with SMTP id bx15so7984080ljb.7 for ; Tue, 11 Apr 2023 14:21:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681248062; 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=+Q5uvyKgsyQ/M8zWHaPBoU8kXjUUWtJVChgiQX6ZkJc=; b=cOCdn27LH/NhS9Efv9wYAEckXNUIgpjgHFOAHCiHU/dUWmFMiN4hW2HurLcQAwXHzl fNryaSno0Ep3Rg7E5dhreDV7I9hP0Yxu1+gLLmCv3oBFOTpcdks30E4CmglkoO2plgIr XKnVmeFpchsZVMdIQU6Z2Shj2fCD5670iVIXqiDa0kyss0quiHLZkvtz1m5TeUxBG3h+ WY5OAfAIV+qnuhgWncDH7zoxCSuAapcyPj2SQ2qXuTZRV24CVH+Hkk4viLMYVKX9E+JZ rVPmQMjDAEIwvX8yeeT3fyt+WeHtyT0XijNMdhLffmVNIv5OgUPOoE6dqA1YJSobY9fU kk6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681248062; 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=+Q5uvyKgsyQ/M8zWHaPBoU8kXjUUWtJVChgiQX6ZkJc=; b=3t8X2C+P/1ebd8ZLAeIRc4yymytLduIurXeQ544FO7NgZAGznGs4UbalZHmmczys8t 8G+AN2JwfqJSV1nKwK8DEno3a5KUt/XxTcE2VlKmBECDwWZp+ruUQpGguSai7KQAB82h VzzqD5odG3EiUElOCInP5jZ1RzWqK06MifBavsIDERytcCEND9PLn16YbP6lONhTL9Uh OelZAULHJVv3AuNX1cs1fvIR7qw1NcP9dsdNibjrOYDp0gLz+6NGtNut8TG07apmCxbZ 2CA2hiN/oYXLFyNiACNMbfse5X1NeDtO6k95R96K3Gi30aL944rFknf0JDwt9Ji3XsUz WOmA== X-Gm-Message-State: AAQBX9csBiy09RztcBFd4ncESnbd0Yzkr9Q8yOlIznKG2NH557nqmirp mnkUrjxDdzYTl7f2ChHERE1YtU9bWqA= X-Google-Smtp-Source: AKy350bIHpYUsilEk92alXMrpcqPNd/9R865++qMoO8HgwPJbwH4unM/5UsarzdeCRVQk+CQV/PnGw== X-Received: by 2002:a2e:8811:0:b0:2a7:77ae:2787 with SMTP id x17-20020a2e8811000000b002a777ae2787mr1974120ljh.20.1681248062176; Tue, 11 Apr 2023 14:21:02 -0700 (PDT) Received: from localhost.localdomain (91-153-198-187.elisa-laajakaista.fi. [91.153.198.187]) by smtp.gmail.com with ESMTPSA id w21-20020a2e9995000000b002a7778bd271sm1195055lji.20.2023.04.11.14.21.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 14:21:01 -0700 (PDT) From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Apr 2023 00:20:42 +0300 Message-Id: <20230411212052.159889-3-jeebjp@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230411212052.159889-1-jeebjp@gmail.com> References: <20230411212052.159889-1-jeebjp@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 02/12] avutil/frame: split side data list wiping out to non-AVFrame function 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: --- libavutil/frame.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/libavutil/frame.c b/libavutil/frame.c index c905e8d611..019613e4d2 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -76,14 +76,18 @@ static void free_side_data(AVFrameSideData **ptr_sd) av_freep(ptr_sd); } -static void wipe_side_data(AVFrame *frame) +static void wipe_side_data(AVFrameSideData ***sd, int *nb_side_data) { - for (int i = 0; i < frame->nb_side_data; i++) { - free_side_data(&frame->side_data[i]); + for (int i = 0; i < *nb_side_data; i++) { + free_side_data(&((*sd)[i])); } - frame->nb_side_data = 0; + *nb_side_data = 0; + + av_freep(sd); +} - av_freep(&frame->side_data); +static void wipe_side_data_from_frame(AVFrame *frame) { + wipe_side_data(&frame->side_data, &frame->nb_side_data); } AVFrame *av_frame_alloc(void) @@ -326,7 +330,7 @@ FF_ENABLE_DEPRECATION_WARNINGS sd_dst = av_frame_new_side_data(dst, sd_src->type, sd_src->size); if (!sd_dst) { - wipe_side_data(dst); + wipe_side_data_from_frame(dst); return AVERROR(ENOMEM); } memcpy(sd_dst->data, sd_src->data, sd_src->size); @@ -335,7 +339,7 @@ FF_ENABLE_DEPRECATION_WARNINGS sd_dst = av_frame_new_side_data_from_buf(dst, sd_src->type, ref); if (!sd_dst) { av_buffer_unref(&ref); - wipe_side_data(dst); + wipe_side_data_from_frame(dst); return AVERROR(ENOMEM); } } @@ -486,7 +490,7 @@ void av_frame_unref(AVFrame *frame) if (!frame) return; - wipe_side_data(frame); + wipe_side_data_from_frame(frame); for (int i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++) av_buffer_unref(&frame->buf[i]); -- 2.40.0 _______________________________________________ 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".