-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix/memory leak #52
base: sgpd_versions
Are you sure you want to change the base?
Conversation
Thanks, there seem to be a problem with the compilation on linux and some basic clang-format issues. |
Complete the Change Formatting with clang-format. |
Do I must use formatting clang-format vesion 13 ? ( as written in isobmff/.github/workflows/clang-format.yml ) |
I think that you need to change the clang-format.yml file (version up)
https://github.com/MPEGGroup/isobmff/blob/master/.github/workflows/clang-format.yml jidicula/[email protected] -> jidicula/[email protected] |
Yep, I remember we fixed some of those issues in the |
err = MP4GetListEntry(moof->atomList, i, (char **)&traf); | ||
if(err) goto bail; | ||
traf->destroy((MP4AtomPtr)traf); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not so sure about this one. Below moof->destroy is called which should already do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand this library's design and understand what you said.
But, If there is no below code
for(i = 0; i < moof->atomList->entryCount; i++)
{
err = MP4GetListEntry(moof->atomList, i, (char **)&traf);
if(err) goto bail;
traf->destroy((MP4AtomPtr)traf);
}
traf is still in memory.
If this code is not matching this library design,
you need to check moof destory's flow.
@@ -34,7 +34,8 @@ static void destroy(MP4AtomPtr s) | |||
|
|||
self = (MP4MovieFragmentAtomPtr)s; | |||
if(self == NULL) BAILWITHERROR(MP4BadParamErr) | |||
DESTROY_ATOM_LIST_F(atomList); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this part child boxes are destroyed which should also include the traf box that you destroy manually in MP4MovieFile.c
@@ -34,7 +34,8 @@ static void destroy(MP4AtomPtr s) | |||
|
|||
self = (MP4MovieFragmentAtomPtr)s; | |||
if(self == NULL) BAILWITHERROR(MP4BadParamErr) | |||
DESTROY_ATOM_LIST_F(atomList); | |||
err = MP4DeleteLinkedList(self->atomList); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already a part of the macro above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In side of Macro code
#define DESTROY_ATOM_LIST \
if(self->atomList) \
{ \
u32 atomListSize; \
err = MP4GetListEntryCount(self->atomList, &atomListSize); \
if(err) goto bail; \
for(i = 0; i < atomListSize; i++) \
{ \
MP4AtomPtr a; \
err = MP4GetListEntry(self->atomList, i, (char **)&a); \
if(err) goto bail; \
if(a) a->destroy(a); \
} \
err = MP4DeleteLinkedList(self->atomList); \
if(err) goto bail; \
}
if(a) a->destroy(a);
err = MP4DeleteLinkedList(self->atomList);
I think that those free the memory same thing
Is it Right or not ?
My Thought is we use only err = MP4DeleteLinkedList(self->atomList);
for free the self->atomList memory.
I do not understand LinkedList have several ListEntry and several entry count.
I add this code due to 'Segmentation Fault Error Raised'
when I free the MP4MovieFragmentAtomPtr
} | ||
} | ||
} | ||
|
||
if(moov->moovAtomPtr) moov->moovAtomPtr->destroy(moov->moovAtomPtr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the above not already handled by this call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If It makes movie atom for fragment mode,
It need to free the memory traf atom and trex atom.
if(moov->moovAtomPtr) moov->moovAtomPtr->destroy(moov->moovAtomPtr);
This part do not free the memory of atoms derived from fragments
First, Solved Memory Leak in traf (MP4TrackFragmentAtom)
Second, Solved Memory Leak in trex (MP4TrackExtendsAtom)
If user makes Fragment Mp4, There are some memory leak.
There is no memory free for MP4TrackFragmentAtom.
There is no memory free for MP4TrackExtendsAtom.
After add Code and completing the test, There is no memory leak.