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 DAD9545452 for ; Fri, 31 Mar 2023 16:22:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E11BE68C2F5; Fri, 31 Mar 2023 19:22:25 +0300 (EEST) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5253568C283 for ; Fri, 31 Mar 2023 19:22:16 +0300 (EEST) Received: by mail-lj1-f171.google.com with SMTP id a44so4975841ljr.10 for ; Fri, 31 Mar 2023 09:22:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680279735; 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=JWrL5L2Awwi8EyK5S5G0YfWizUrCXnEw0SdKnzbf4xA=; b=d9LPhDLx9undcNxWnT9p/lIwMSwdt8oOHAFb423IF8k+gCpP2zenroLV80/D7Qbp9b QwPt4APoYHsZvZqHIB9ZBvACkSided3FCSIf3sYfbyGauKQKIi44+WposAEgRMybC+yR nPXTQKYKuG/DSyXcM0ER7GIBOSHdGZfOdGj+guDZPN9JVZl5D7dyzW5R+lWuHUNwO//E 9fE4PFZParE0MWm/mF5OBp+TqqQ6SUmOALFsGH843dDjPXPqbMNBY16LXqEUFK7ycJf6 1PlKOeN0ETFaXuwRj5GnJG5MkKxI2iOTDxULbAmX1gC+EhMvzu0Rt2QjVpmMcBop7EXJ GN7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680279735; 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=JWrL5L2Awwi8EyK5S5G0YfWizUrCXnEw0SdKnzbf4xA=; b=SDmSyb+Su5un7Mh9tlJz4OG/SLoVP9Ui4Klf9obu/mt8osZdN6pFesKxK0Lqb7zrwR P4v+NlhAhR19cp4QWOV0gJQ7/GJxUgHFL9hnHGX8l6HNsH8xl68uyhZy7qd81Kv8Kbd9 flp3N3VnGjIz4Ey6pd8YK6ZtZYlonXd6fxPVvs4Fut3TwGQNVNIdxS/SMSakj7eLbPTq sDpMiHwoFvgNWJlCrLZzuAo5nPCroqlkiqLcSWu201bdGShUbbcEPg+0UPfKP9V5pRRq OnS1KacU/t1UKHn43T5ZdMKkPvOAbZlrOADgvGpjoYUk6+DLGlQvrbKSX8F8YC+Pmf12 sdFw== X-Gm-Message-State: AAQBX9cWE/8tgudybUMHL+iQko+ZV5YPizvrQANKQz3tgQs0r6YW4hG4 U8Kp8Z/pxk9KTt8IDuVfRjGkc4A+J8A= X-Google-Smtp-Source: AKy350YTYkyNRbvfTYPvhi/zOyJo2fHThYcgPE3+Ylc0RBom/rVMcVZmYkFZFY56Tap6VN4NZMtaCg== X-Received: by 2002:a2e:9d82:0:b0:2a6:1780:7700 with SMTP id c2-20020a2e9d82000000b002a617807700mr1972234ljj.1.1680279735190; Fri, 31 Mar 2023 09:22:15 -0700 (PDT) Received: from localhost.localdomain (91-153-198-187.elisa-laajakaista.fi. [91.153.198.187]) by smtp.gmail.com with ESMTPSA id n20-20020a2e8794000000b0029573844d03sm411483lji.109.2023.03.31.09.22.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 09:22:14 -0700 (PDT) From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 31 Mar 2023 19:21:55 +0300 Message-Id: <20230331162205.428735-3-jeebjp@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230331162205.428735-1-jeebjp@gmail.com> References: <20230331162205.428735-1-jeebjp@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v1 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.39.2 _______________________________________________ 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".