-
Notifications
You must be signed in to change notification settings - Fork 515
Open
Description
Hi, I found a memory leak in Source/C++/Core/Ap4Array.h when testing mp4split on x86-64 Ubuntu 22.04
Files:
command line used:
./mp4split --verbose --init-segment /dev/null --media-segment /dev/nulll --pattern-parameters N ./1
Source:
" 168 // check if we already have enough",
" 169 if (count <= m_AllocatedCount) return AP4_SUCCESS;",
" 170 ",
" 171 // (re)allocate the items",
"--->172 T* new_items = (T*) ::operator new (count*sizeof(T));",
" 173 if (new_items == NULL) {",
" 174 return AP4_ERROR_OUT_OF_MEMORY;",
" 175 }",
" 176 if (m_ItemCount && m_Items) {",
" 177 for (unsigned int i=0; i<m_ItemCount; i++) {"
ASAN report:
"Indirect leak of 1490528 byte(s) in 2 object(s) allocated from:",
" #0 0x55555567486d in operator new(unsigned long) (mp4split_asan+0x12086d) (BuildId: b03cd8279a7af67fde5a40b839ac3bfacde6a9c0)",
" #1 0x5555556be8fc in AP4_Array<AP4_DataBuffer>::EnsureCapacity(unsigned int) Bento4/Source/C++/Core/Ap4Array.h:172:25",
" #2 0x5555556be8fc in AP4_Array<AP4_DataBuffer>::SetItemCount(unsigned int) Bento4/Source/C++/Core/Ap4Array.h:210:25",
" #3 0x5555556bcb70 in AP4_HvccAtom::AP4_HvccAtom(unsigned int, unsigned char const*) Bento4/Source/C++/Core/Ap4HvccAtom.cpp:296:21",
" #4 0x5555556b98c9 in AP4_HvccAtom::Create(unsigned int, AP4_ByteStream&) Bento4/Source/C++/Core/Ap4HvccAtom.cpp:90:16",
" #5 0x555555687173 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned int, unsigned int, unsigned long long, AP4_Atom*&) Bento4/Source/C++/Core/Ap4AtomFactory.cpp:518:20",
" #6 0x555555686347 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned long long&, AP4_Atom*&) Bento4/Source/C++/Core/Ap4AtomFactory.cpp:234:14",
" #7 0x555555697562 in AP4_ContainerAtom::ReadChildren(AP4_AtomFactory&, AP4_ByteStream&, unsigned long long) Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:196:12",
" #8 0x555555709c7b in AP4_VisualSampleEntry::AP4_VisualSampleEntry(unsigned int, unsigned int, AP4_ByteStream&, AP4_AtomFactory&) Bento4/Source/C++/Core/Ap4SampleEntry.cpp:884:5",
" #9 0x555555709c7b in AP4_AvcSampleEntry::AP4_AvcSampleEntry(unsigned int, unsigned int, AP4_ByteStream&, AP4_AtomFactory&) Bento4/Source/C++/Core/Ap4SampleEntry.cpp:1136:5",
" #10 0x555555687bd3 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned int, unsigned int, unsigned long long, AP4_Atom*&) Bento4/Source/C++/Core/Ap4AtomFactory.cpp:319:24",
" #11 0x555555686347 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned long long&, AP4_Atom*&) Bento4/Source/C++/Core/Ap4AtomFactory.cpp:234:14",
" #12 0x555555719328 in AP4_StsdAtom::AP4_StsdAtom(unsigned int, unsigned char, unsigned int, AP4_ByteStream&, AP4_AtomFactory&) Bento4/Source/C++/Core/Ap4StsdAtom.cpp:102:13",
" #13 0x55555571859b in AP4_StsdAtom::Create(unsigned int, AP4_ByteStream&, AP4_AtomFactory&) Bento4/Source/C++/Core/Ap4StsdAtom.cpp:57:16",
" #14 0x555555687d9b in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned int, unsigned int, unsigned long long, AP4_Atom*&) Bento4/Source/C++/Core/Ap4AtomFactory.cpp:458:20",
" #15 0x555555686347 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned long long&, AP4_Atom*&) Bento4/Source/C++/Core/Ap4AtomFactory.cpp:234:14",
" #16 0x555555697562 in AP4_ContainerAtom::ReadChildren(AP4_AtomFactory&, AP4_ByteStream&, unsigned long long) Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:196:12",
" #17 0x5555556969c0 in AP4_ContainerAtom::AP4_ContainerAtom(unsigned int, unsigned long long, bool, AP4_ByteStream&, AP4_AtomFactory&) Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:140:5",
" #18 0x5555556969c0 in AP4_ContainerAtom::Create(unsigned int, unsigned long long, bool, bool, AP4_ByteStream&, AP4_AtomFactory&) Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:88:20",
" #19 0x555555687aea in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned int, unsigned int, unsigned long long, AP4_Atom*&) Bento4/Source/C++/Core/Ap4AtomFactory.cpp:816:20",
" #20 0x555555686347 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned long long&, AP4_Atom*&) Bento4/Source/C++/Core/Ap4AtomFactory.cpp:234:14",
" #21 0x555555697720 in AP4_ContainerAtom::ReadChildren(AP4_AtomFactory&, AP4_ByteStream&, unsigned long long) Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:196:12",
" #22 0x5555556969c0 in AP4_ContainerAtom::AP4_ContainerAtom(unsigned int, unsigned long long, bool, AP4_ByteStream&, AP4_AtomFactory&) Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:140:5",
" #23 0x5555556969c0 in AP4_ContainerAtom::Create(unsigned int, unsigned long long, bool, bool, AP4_ByteStream&, AP4_AtomFactory&) Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:88:20",
" #24 0x555555687aea in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned int, unsigned int, unsigned long long, AP4_Atom*&) Bento4/Source/C++/Core/Ap4AtomFactory.cpp:816:20",
" #25 0x555555686347 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned long long&, AP4_Atom*&) Bento4/Source/C++/Core/Ap4AtomFactory.cpp:234:14",
" #26 0x555555697720 in AP4_ContainerAtom::ReadChildren(AP4_AtomFactory&, AP4_ByteStream&, unsigned long long) Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:196:12",
" #27 0x5555556969c0 in AP4_ContainerAtom::AP4_ContainerAtom(unsigned int, unsigned long long, bool, AP4_ByteStream&, AP4_AtomFactory&) Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:140:5",
" #28 0x5555556969c0 in AP4_ContainerAtom::Create(unsigned int, unsigned long long, bool, bool, AP4_ByteStream&, AP4_AtomFactory&) Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:88:20",
" #29 0x555555687aea in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned int, unsigned int, unsigned long long, AP4_Atom*&) Bento4/Source/C++/Core/Ap4AtomFactory.cpp:816:20",
" #30 0x555555686347 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned long long&, AP4_Atom*&) Bento4/Source/C++/Core/Ap4AtomFactory.cpp:234:14",
" #31 0x555555697720 in AP4_ContainerAtom::ReadChildren(AP4_AtomFactory&, AP4_ByteStream&, unsigned long long) Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:196:12",
" #32 0x5555556973f3 in AP4_ContainerAtom::AP4_ContainerAtom(unsigned int, unsigned long long, bool, AP4_ByteStream&, AP4_AtomFactory&) Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:140:5",
" #33 0x55555572d960 in AP4_TrakAtom::AP4_TrakAtom(unsigned int, AP4_ByteStream&, AP4_AtomFactory&) Bento4/Source/C++/Core/Ap4TrakAtom.cpp:165:5",
" #34 0x55555568a351 in AP4_TrakAtom::Create(unsigned int, AP4_ByteStream&, AP4_AtomFactory&) Bento4/Source/C++/Core/Ap4TrakAtom.h:58:20",
"",
Let me know if you need more information!
Metadata
Metadata
Assignees
Labels
No labels