From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 4/5] avformat/iamf: Don't mix ownership and non-ownership pointers
Date: Mon, 19 Feb 2024 19:03:08 -0300
Message-ID: <7af81554-3be8-4ddf-ad83-dd3ea1784bcf@gmail.com> (raw)
In-Reply-To: <AS8P250MB0744A49A22A8F91AEBDC37648F512@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>
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 <andreas.rheinhardt@outlook.com>
> ---
> 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".
next prev parent reply other threads:[~2024-02-19 22:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-19 21:51 [FFmpeg-devel] [PATCH 1/5] avformat/iamf_writer: Don't leak on error when adding ParamDefinition Andreas Rheinhardt
2024-02-19 21:52 ` [FFmpeg-devel] [PATCH 2/5] avformat/iamf_writer: Remove nonsense check Andreas Rheinhardt
2024-02-19 21:57 ` James Almer
2024-02-19 21:52 ` [FFmpeg-devel] [PATCH 3/5] avformat/iamf_writer: Don't memset twice Andreas Rheinhardt
2024-02-19 21:57 ` James Almer
2024-02-19 21:52 ` [FFmpeg-devel] [PATCH 4/5] avformat/iamf: Don't mix ownership and non-ownership pointers Andreas Rheinhardt
2024-02-19 22:03 ` James Almer [this message]
2024-02-19 22:06 ` Andreas Rheinhardt
2024-02-19 22:06 ` James Almer
2024-02-19 21:52 ` [FFmpeg-devel] [PATCH 5/5] avformat/iamf_writer: Fix leaks on error Andreas Rheinhardt
2024-02-19 21:55 ` James Almer
2024-02-19 22:17 ` [FFmpeg-devel] [PATCH v2 5/6] avformat/iamf_writer: Return proper error codes Andreas Rheinhardt
2024-02-19 22:22 ` James Almer
2024-02-19 22:17 ` [FFmpeg-devel] [PATCH v2 6/6] avformat/iamf_writer: Fix leaks on error Andreas Rheinhardt
2024-02-19 22:19 ` James Almer
2024-02-19 22:19 ` [FFmpeg-devel] [PATCH 1/5] avformat/iamf_writer: Don't leak on error when adding ParamDefinition James Almer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7af81554-3be8-4ddf-ad83-dd3ea1784bcf@gmail.com \
--to=jamrial@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git