Hi, there.

There is a large memory leak issue (> 200 mb) in CreateDescriptorFromStream, Ap4DescriptorFactory.cpp:90 in the newest branch 5922ba762af46.

To reproduce it, run
~~~~
mp4info poc 
~~~~

POC:
[poc.zip](https://github.com/axiomatic-systems/Bento4/files/7014506/mp42aac-leak-CreateDescriptorFromStream90.zip)
(unzip first)

Here is the reproduce trace reported by ASAN:
~~~~
==3162==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 88 byte(s) in 1 object(s) allocated from:
    #0 0x4f2a58 in operator new(unsigned long) /dependence/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:99
    #1 0x6dc366 in AP4_DescriptorFactory::CreateDescriptorFromStream(AP4_ByteStream&, AP4_Descriptor*&) /mnt/data/playground/Bento4/Source/C++/Core/Ap4DescriptorFactory.cpp:90:26
    #2 0x585473 in AP4_EsdsAtom::AP4_EsdsAtom(unsigned int, unsigned char, unsigned int, AP4_ByteStream&) /mnt/data/playground/Bento4/Source/C++/Core/Ap4EsdsAtom.cpp:76:9
    #3 0x58505e in AP4_EsdsAtom::Create(unsigned int, AP4_ByteStream&) /mnt/data/playground/Bento4/Source/C++/Core/Ap4EsdsAtom.cpp:52:16
    #4 0x543334 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned int, unsigned int, unsigned long long, AP4_Atom*&) /mnt/data/playground/Bento4/Source/C++/Core/Ap4AtomFactory.cpp:508:20
    #5 0x53ed78 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned long long&, AP4_Atom*&) /mnt/data/playground/Bento4/Source/C++/Core/Ap4AtomFactory.cpp:234:14
    #6 0x559f8c in AP4_ContainerAtom::ReadChildren(AP4_AtomFactory&, AP4_ByteStream&, unsigned long long) /mnt/data/playground/Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:194:12
    #7 0x559d20 in AP4_ContainerAtom::AP4_ContainerAtom(unsigned int, unsigned long long, bool, AP4_ByteStream&, AP4_AtomFactory&) /mnt/data/playground/Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:139:5

Indirect leak of 270068111 byte(s) in 6 object(s) allocated from:
    #0 0x4f2bb8 in operator new[](unsigned long) /dependence/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:102
    #1 0x578cc6 in AP4_DataBuffer::ReallocateBuffer(unsigned int) /mnt/data/playground/Bento4/Source/C++/Core/Ap4DataBuffer.cpp:210:28

....

SUMMARY: AddressSanitizer: 270069632 byte(s) leaked in 52 allocation(s).
~~~~
Memory leak in CreateDescriptorFromStream, Ap4DescriptorFactory.cpp:90
This is a GitHub Issue
repo:Bento4
owner:axiomatic-systems
Title : Memory leak in CreateDescriptorFromStream, Ap4DescriptorFactory.cpp:90
Issue date:

--- start body ---
Hi, there.

There is a large memory leak issue (> 200 mb) in CreateDescriptorFromStream, Ap4DescriptorFactory.cpp:90 in the newest branch 5922ba762af46.

To reproduce it, run
~~~~
mp4info poc 
~~~~

POC:
[poc.zip](https://github.com/axiomatic-systems/Bento4/files/7014506/mp42aac-leak-CreateDescriptorFromStream90.zip)
(unzip first)

Here is the reproduce trace reported by ASAN:
~~~~
==3162==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 88 byte(s) in 1 object(s) allocated from:
    #0 0x4f2a58 in operator new(unsigned long) /dependence/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:99
    #1 0x6dc366 in AP4_DescriptorFactory::CreateDescriptorFromStream(AP4_ByteStream&, AP4_Descriptor*&) /mnt/data/playground/Bento4/Source/C++/Core/Ap4DescriptorFactory.cpp:90:26
    #2 0x585473 in AP4_EsdsAtom::AP4_EsdsAtom(unsigned int, unsigned char, unsigned int, AP4_ByteStream&) /mnt/data/playground/Bento4/Source/C++/Core/Ap4EsdsAtom.cpp:76:9
    #3 0x58505e in AP4_EsdsAtom::Create(unsigned int, AP4_ByteStream&) /mnt/data/playground/Bento4/Source/C++/Core/Ap4EsdsAtom.cpp:52:16
    #4 0x543334 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned int, unsigned int, unsigned long long, AP4_Atom*&) /mnt/data/playground/Bento4/Source/C++/Core/Ap4AtomFactory.cpp:508:20
    #5 0x53ed78 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&, unsigned long long&, AP4_Atom*&) /mnt/data/playground/Bento4/Source/C++/Core/Ap4AtomFactory.cpp:234:14
    #6 0x559f8c in AP4_ContainerAtom::ReadChildren(AP4_AtomFactory&, AP4_ByteStream&, unsigned long long) /mnt/data/playground/Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:194:12
    #7 0x559d20 in AP4_ContainerAtom::AP4_ContainerAtom(unsigned int, unsigned long long, bool, AP4_ByteStream&, AP4_AtomFactory&) /mnt/data/playground/Bento4/Source/C++/Core/Ap4ContainerAtom.cpp:139:5

Indirect leak of 270068111 byte(s) in 6 object(s) allocated from:
    #0 0x4f2bb8 in operator new[](unsigned long) /dependence/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:102
    #1 0x578cc6 in AP4_DataBuffer::ReallocateBuffer(unsigned int) /mnt/data/playground/Bento4/Source/C++/Core/Ap4DataBuffer.cpp:210:28

....

SUMMARY: AddressSanitizer: 270069632 byte(s) leaked in 52 allocation(s).
~~~~
--- end body ---
