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 1467049807 for ; Mon, 19 Feb 2024 22:03:18 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2574268D41B; Tue, 20 Feb 2024 00:03:16 +0200 (EET) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8AFE968D2D8 for ; Tue, 20 Feb 2024 00:03:09 +0200 (EET) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1db5212e2f6so34587095ad.1 for ; Mon, 19 Feb 2024 14:03:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708380187; x=1708984987; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=RZWVYGWxYlCfueXSp0reD6Z0EXHeiEVayaJb3H5IKuk=; b=L48q3F1es9SOGp9KpSU95xi9XI+N5ohEHa0Rg5x7ihBo9NFlmtnQ3CkxUlsClLTKp/ 6PL95gI5hMZ+DOK7frgG+CJWOPMwGQSVMemMhzBoqaesKi1QBi5xn3jKoDI6UIg/8WLS 9rWq4uOZu02gOitWVtLKKZkU5QLjQjM8tJ1ojijciBopdY3xe1l569xELhvv+sIcSKM4 QkLkV55gkOifR9tT04UmkyRTJlgKle5k/K3TPtiHtVAbF9/ZZTPSDN+YKQhgBxkN4bQf O96+pHGc4xJoxFFu7h9QZZFZz+pJftQ19YDunhvXPiRBl4ZE0X6TAX3Xd27NcMjfHxsM KVhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708380187; x=1708984987; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RZWVYGWxYlCfueXSp0reD6Z0EXHeiEVayaJb3H5IKuk=; b=sdedlv26bb/xHZPs/X0mF03iqZ7+pqQfMkmR95iYWvuQD0hr9aAv5VGk+DxtHvkqzn rZFLSAq6iv+g2C9k59piYqaTjBbeSTzsF5Gsg+Vl1tUpgEZFpM3K3QHZwGfJWEForJjG gCLlfQn9TaSdS/YZp4FpdZaEehJiS671pjkfY1zxHi7w+b7KP8I91NPsVj6550VR1bcv MtGMal0HDlk5M1K0nGVcV+nxo7O98vMfL6fWP6NS9yMaEnlYsC4v4v5c8FdrVjK7GohZ umzSgg/HnPWBs9PBVHE/74SpabVTqkyI+pyXh0fVBKpzBGm4Ny3K56ORZXoVKnMACCFX ImoQ== X-Gm-Message-State: AOJu0YyzHpq9vOEog2QEtbeyGQpjX0735Bk2DHmIqbHJbErXqkXtuw8d f8W6H01LAiD7gLm5BYahbZWCURTsqUG+x+heGidMHUcbWZ7Kzt9lLSBk66AD X-Google-Smtp-Source: AGHT+IEYlBIFA0YDTgfUV2QiZfjy2SS9NxgNQ5mIsL6VFVD0iZ4C1YlCT76RRjQd012WLen4p1BrgQ== X-Received: by 2002:a17:903:1209:b0:1d9:907f:636d with SMTP id l9-20020a170903120900b001d9907f636dmr26084773plh.10.1708380186509; Mon, 19 Feb 2024 14:03:06 -0800 (PST) Received: from [192.168.0.16] ([190.194.169.124]) by smtp.gmail.com with ESMTPSA id g6-20020a1709026b4600b001d8d90d4f67sm4867786plt.249.2024.02.19.14.03.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Feb 2024 14:03:06 -0800 (PST) Message-ID: <7af81554-3be8-4ddf-ad83-dd3ea1784bcf@gmail.com> Date: Mon, 19 Feb 2024 19:03:08 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 4/5] avformat/iamf: Don't mix ownership and non-ownership 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 2/19/2024 6:52 PM, Andreas Rheinhardt wrote: > IAMFAudioElement and IAMFMixPresentation currently contain > pointers to independently allocated objects that are sometimes > owned by said structures and sometimes not. > > More precisely, upon success the demuxer transfers ownership > of these other objects newly created AVStreamGroups, but it > keeps its pointers. iamf_read_close() therefore always resets > these pointers (because the cleanup code always treats them > as ownership pointers). This leads to memory leaks in case > iamf_read_header() without having attached all of these > objects to stream groups. > > The muxer has a similar issue: It also clears these pointers > (pointing to objects owned by stream groups created by the user) > in its deinit function. > > This commit fixes this memleak by explicitly adding non-ownership > pointers; this also allows to remove the code to reset the > ownership pointers. > > Signed-off-by: Andreas Rheinhardt > --- > libavformat/iamf.h | 10 ++++++++++ > libavformat/iamf_parse.c | 2 ++ > libavformat/iamf_writer.c | 16 ++++++++-------- > libavformat/iamfdec.c | 22 ++++++++-------------- > libavformat/iamfenc.c | 12 +----------- > 5 files changed, 29 insertions(+), 33 deletions(-) > > diff --git a/libavformat/iamf.h b/libavformat/iamf.h > index d88a24c435..0cb0902e86 100644 > --- a/libavformat/iamf.h > +++ b/libavformat/iamf.h > @@ -86,6 +86,11 @@ typedef struct IAMFSubStream { > } IAMFSubStream; > > typedef struct IAMFAudioElement { > + const AVIAMFAudioElement *celement; > + /** > + * element backs celement iff the AVIAMFAudioElement Typo. Also in IAMFMixPresentation. Should be ok otherwise. _______________________________________________ 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".