diff --git a/Source/C++/Core/Ap4EsdsAtom.cpp b/Source/C++/Core/Ap4EsdsAtom.cpp index 58f4ee97..5377a10d 100644 --- a/Source/C++/Core/Ap4EsdsAtom.cpp +++ b/Source/C++/Core/Ap4EsdsAtom.cpp @@ -76,6 +76,9 @@ AP4_EsdsAtom::AP4_EsdsAtom(AP4_UI32 size, if (AP4_DescriptorFactory::CreateDescriptorFromStream(stream, descriptor) == AP4_SUCCESS) { m_EsDescriptor = AP4_DYNAMIC_CAST(AP4_EsDescriptor, descriptor); + if (!m_EsDescriptor) { + delete descriptor; + } } else { m_EsDescriptor = NULL; }