An issue was discovered in Bento4 v1.5.1-627. There is a memory leak in AP4_DescriptorFactory::CreateDescriptorFromStream in Core/Ap4DescriptorFactory.cpp when called from the AP4_EsdsAtom class in Core/Ap4EsdsAtom.cpp, as demonstrated by mp42aac.
cpe:2.3:a:axiosys:bento4:1.5.1-627:*:*:*:*:*:*:*
F87642DF-B939-4195-A2AE-F0F1D39CD16D
OR
there is memory leaks in Ap4String.cpp

./mp42aac    poc   /dev/null

=================================================================
==15810==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 96 byte(s) in 1 object(s) allocated from:
    #0 0x522860 in operator new(unsigned long) (/root/apps/Bento4/mp42aac+0x522860)
    #1 0x5c80a5 in AP4_DescriptorFactory::CreateDescriptorFromStream(AP4_ByteStream&, AP4_Descriptor*&) /root/apps/Bento4/Source/C++/Core/Ap4DescriptorFactory.cpp:122:22
    #2 0x5f8687 in AP4_EsdsAtom::AP4_EsdsAtom(unsigned int, unsigned char, unsigned int, AP4_ByteStream&) /root/apps/Bento4/Source/C++/Core/Ap4EsdsAtom.cpp:76:9
    #3 0x5f8687 in AP4_EsdsAtom::Create(unsigned int, AP4_ByteStream&) /root/apps/Bento4/Source/C++/Core/Ap4EsdsAtom.cpp:52
    #4 0x5e14cb in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned int, unsigned int, unsigned long long, AP4_Atom*&) /root/apps/Bento4/Source/C++/Core/Ap4AtomFactory.cpp:474:20
    #5 0x5ddaa0 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned long long&, AP4_Atom*&) /root/apps/Bento4/Source/C++/Core/Ap4AtomFactory.cpp:221:14
    #6 0x5d6aa5 in AP4_ContainerAtom::ReadChildren(AP4_AtomFactory&, AP4_ByteStream&, unsigned long long) /root/apps/Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:194:12
    #7 0x56699d in AP4_SampleEntry::Read(AP4_ByteStream&, AP4_AtomFactory&) /root/apps/Bento4/Source/C++/Core/Ap4SampleEntry.cpp:115:9

Indirect leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x5229e0 in operator new[](unsigned long) (/root/apps/Bento4/mp42aac+0x5229e0)
    #1 0x557d0a in AP4_String::Assign(char const*, unsigned int) /root/apps/Bento4/Source/C++/Core/Ap4String.cpp:165:15

SUMMARY: AddressSanitizer: 128 byte(s) leaked in 2 allocation(s).

[bento4-memory-leak-AP4_String.zip](https://github.com/axiomatic-systems/Bento4/files/2746334/bento4-memory-leak-AP4_String.zip)



memory leaks in Ap4String.cpp
This is a GitHub Issue
repo:Bento4
owner:axiomatic-systems
Title : memory leaks in Ap4String.cpp
Issue date:

--- start body ---
there is memory leaks in Ap4String.cpp

./mp42aac    poc   /dev/null

=================================================================
==15810==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 96 byte(s) in 1 object(s) allocated from:
    #0 0x522860 in operator new(unsigned long) (/root/apps/Bento4/mp42aac+0x522860)
    #1 0x5c80a5 in AP4_DescriptorFactory::CreateDescriptorFromStream(AP4_ByteStream&, AP4_Descriptor*&) /root/apps/Bento4/Source/C++/Core/Ap4DescriptorFactory.cpp:122:22
    #2 0x5f8687 in AP4_EsdsAtom::AP4_EsdsAtom(unsigned int, unsigned char, unsigned int, AP4_ByteStream&) /root/apps/Bento4/Source/C++/Core/Ap4EsdsAtom.cpp:76:9
    #3 0x5f8687 in AP4_EsdsAtom::Create(unsigned int, AP4_ByteStream&) /root/apps/Bento4/Source/C++/Core/Ap4EsdsAtom.cpp:52
    #4 0x5e14cb in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned int, unsigned int, unsigned long long, AP4_Atom*&) /root/apps/Bento4/Source/C++/Core/Ap4AtomFactory.cpp:474:20
    #5 0x5ddaa0 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned long long&, AP4_Atom*&) /root/apps/Bento4/Source/C++/Core/Ap4AtomFactory.cpp:221:14
    #6 0x5d6aa5 in AP4_ContainerAtom::ReadChildren(AP4_AtomFactory&, AP4_ByteStream&, unsigned long long) /root/apps/Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:194:12
    #7 0x56699d in AP4_SampleEntry::Read(AP4_ByteStream&, AP4_AtomFactory&) /root/apps/Bento4/Source/C++/Core/Ap4SampleEntry.cpp:115:9

Indirect leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x5229e0 in operator new[](unsigned long) (/root/apps/Bento4/mp42aac+0x5229e0)
    #1 0x557d0a in AP4_String::Assign(char const*, unsigned int) /root/apps/Bento4/Source/C++/Core/Ap4String.cpp:165:15

SUMMARY: AddressSanitizer: 128 byte(s) leaked in 2 allocation(s).

[bento4-memory-leak-AP4_String.zip](https://github.com/axiomatic-systems/Bento4/files/2746334/bento4-memory-leak-AP4_String.zip)



--- end body ---

comments :
--- start comments ---

--- end comments ---