Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-84094

Potential memory leak due to missing virtual destructor in AnchorVertex base class

    XMLWordPrintable

Details

    • 6a90078d6bfe7900b6c9a6ea8c758172c7bc241f (qt/qtbase/dev) 31d7252d1c8d7fd7430903460e4093234f469e1a (qt/qtbase/5.15)

    Description

      AnchorVertex is subclassed by AnchorVertexPair, which adds non-POD data members, resulting in the compiler generating a default destructor.

      AnchorVertexPair objects are allocated with operator new and upcast when placed into QList<AnchorVertex*>, for instance in calls to replaceVertex. Deletion of those instances is then done via qDeleteAll on the lists, or otherwise primarily by deleting AnchorVertex pointers. There is only a single case where a AnchorVertexPair* is deleted, and no case where the type of the instance is checked (via the m_type member) before deleting instances.

      This makes it very likely that there are memory leaks, as deleting an AnchorVertexPair instance through a AnchorVertex* will not call the generated ~AnchorVertexPair destructor.

      Coverity ID 218707

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              vhilshei Volker Hilsheimer
              vhilshei Volker Hilsheimer
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes