Skip to content

Internal field not properly initialized and released in VssBackupComponents. #49

@antonalabin

Description

@antonalabin

Hello. I think there is a bug in the code.
Shouldn't m_IVssBackupComponentsEx4(0) also be there?

VssBackupComponents::VssBackupComponents()
            : m_backup(0),
            m_IVssBackupComponentsEx(0),
            m_IVssBackupComponentsEx2(0),
            m_IVssBackupComponentsEx3(0),
            m_writerMetadata(nullptr),
            m_writerComponents(nullptr),
            m_writerStatus(nullptr)

         {
            m_writerMetadata = gcnew WriterMetadataList(this);
            m_writerComponents = gcnew WriterComponentsList(this);
            m_writerStatus = gcnew WriterStatusList(this);

            pin_ptr<::IVssBackupComponents*> pVssObject = &m_backup;
            CheckCom(CreateVssBackupComponents(pVssObject));
         }

         VssBackupComponents::~VssBackupComponents()
         {
            this->!VssBackupComponents();
         }

         VssBackupComponents::!VssBackupComponents()
         {
            if (m_backup != 0)
            {
               m_backup->Release();
               m_backup = 0;
            }

            if (m_IVssBackupComponentsEx != 0)
            {
               m_IVssBackupComponentsEx->Release();
               m_IVssBackupComponentsEx = 0;
            }

            if (m_IVssBackupComponentsEx2 != 0)
            {
               m_IVssBackupComponentsEx2->Release();
               m_IVssBackupComponentsEx2 = 0;
            }

            if (m_IVssBackupComponentsEx3 != 0)
            {
               m_IVssBackupComponentsEx3->Release();
               m_IVssBackupComponentsEx3 = 0;
            }
         }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions