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

Memory leak in QJsonDocument::fromJson()

    XMLWordPrintable

    Details

    • Commits:
      1b4a5ecc91 (qt/qtbase/dev) 6eed0d3f4e (qt/qtbase/6.2) 2ed7c64dd9 (qt/qtbase/6.3) 6eed0d3f4e (qt/tqtc-qtbase/6.2) 47d77dd552 (qt/tqtc-qtbase/5.15)

      Description

      1. Have a build of qtbase configured with "-sanitize address".
      2. Build the attached project.
        qt-cmake -S /tmp/report/ && cmake --build .
        
      3. Run the resulting program.
        The address sanitizer reports memory leaks:
        =================================================================
        ==24183==ERROR: LeakSanitizer: detected memory leaks
        
        Direct leak of 64 byte(s) in 1 object(s) allocated from:
            #0 0x4c8dfd in operator new(unsigned long) (/tmp/build-report/report+0x4c8dfd)
            #1 0x4e8d39 in QJsonPrivate::Parser::parseObject() (/tmp/build-report/report+0x4e8d39)
            #2 0x4ec05f in QJsonPrivate::Parser::parseValue() (/tmp/build-report/report+0x4ec05f)
            #3 0x4ea318 in QJsonPrivate::Parser::parseMember() (/tmp/build-report/report+0x4ea318)
            #4 0x4e8b46 in QJsonPrivate::Parser::parseObject() (/tmp/build-report/report+0x4e8b46)
            #5 0x4e7250 in QJsonPrivate::Parser::parse(QJsonParseError*) (/tmp/build-report/report+0x4e7250)
            #6 0x4cfc7c in QJsonDocument::fromJson(QByteArray const&, QJsonParseError*) (/tmp/build-report/report+0x4cfc7c)
            #7 0x4cb89d in main (/tmp/build-report/report+0x4cb89d)
            #8 0x7fdcca4650b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
        
        Indirect leak of 66 byte(s) in 1 object(s) allocated from:
            #0 0x49968d in malloc (/tmp/build-report/report+0x49968d)
            #1 0x687d7d in QArrayData::allocate(QArrayData**, long long, long long, long long, QArrayData::AllocationOption) (/tmp/build-report/report+0x687d7d)
            #2 0x4e05a4 in QArrayDataPointer<QtCbor::Element>::allocateGrow(QArrayDataPointer<QtCbor::Element> const&, long long, QArrayData::GrowthPosition) (/tmp/build-report/report+0x4e05a4)
            #3 0x4dfa36 in QArrayDataPointer<QtCbor::Element>::reallocateAndGrow(QArrayData::GrowthPosition, long long, QArrayDataPointer<QtCbor::Element>*) (/tmp/build-report/report+0x4dfa36)
            #4 0x4e46ba in QArrayDataPointer<QtCbor::Element>::detachAndGrow(QArrayData::GrowthPosition, long long, QtCbor::Element const**, QArrayDataPointer<QtCbor::Element>*) (/tmp/build-report/report+0x4e46ba)
            #5 0x4e434e in void QtPrivate::QPodArrayOps<QtCbor::Element>::emplace<QtCbor::Element>(long long, QtCbor::Element&&) (/tmp/build-report/report+0x4e434e)
            #6 0x4ee78c in QCborContainerPrivate::appendByteData(char const*, long long, QCborValue::Type, QFlags<QtCbor::Element::ValueFlag>) (/tmp/build-report/report+0x4ee78c)
            #7 0x4eb4df in QJsonPrivate::Parser::parseString() (/tmp/build-report/report+0x4eb4df)
            #8 0x4e9f33 in QJsonPrivate::Parser::parseMember() (/tmp/build-report/report+0x4e9f33)
            #9 0x4e8b46 in QJsonPrivate::Parser::parseObject() (/tmp/build-report/report+0x4e8b46)
            #10 0x4ec05f in QJsonPrivate::Parser::parseValue() (/tmp/build-report/report+0x4ec05f)
            #11 0x4ea318 in QJsonPrivate::Parser::parseMember() (/tmp/build-report/report+0x4ea318)
            #12 0x4e8b46 in QJsonPrivate::Parser::parseObject() (/tmp/build-report/report+0x4e8b46)
            #13 0x4e7250 in QJsonPrivate::Parser::parse(QJsonParseError*) (/tmp/build-report/report+0x4e7250)
            #14 0x4cfc7c in QJsonDocument::fromJson(QByteArray const&, QJsonParseError*) (/tmp/build-report/report+0x4cfc7c)
            #15 0x4cb89d in main (/tmp/build-report/report+0x4cb89d)
            #16 0x7fdcca4650b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
        
        Indirect leak of 34 byte(s) in 1 object(s) allocated from:
            #0 0x49968d in malloc (/tmp/build-report/report+0x49968d)
            #1 0x687d7d in QArrayData::allocate(QArrayData**, long long, long long, long long, QArrayData::AllocationOption) (/tmp/build-report/report+0x687d7d)
            #2 0x530ee5 in QByteArray::reallocData(long long, QArrayData::AllocationOption) (/tmp/build-report/report+0x530ee5)
            #3 0x52ef45 in QByteArray::resize(long long) (/tmp/build-report/report+0x52ef45)
            #4 0x4ee603 in QCborContainerPrivate::appendByteData(char const*, long long, QCborValue::Type, QFlags<QtCbor::Element::ValueFlag>) (/tmp/build-report/report+0x4ee603)
            #5 0x4eb4df in QJsonPrivate::Parser::parseString() (/tmp/build-report/report+0x4eb4df)
            #6 0x4e9f33 in QJsonPrivate::Parser::parseMember() (/tmp/build-report/report+0x4e9f33)
            #7 0x4e8b46 in QJsonPrivate::Parser::parseObject() (/tmp/build-report/report+0x4e8b46)
            #8 0x4ec05f in QJsonPrivate::Parser::parseValue() (/tmp/build-report/report+0x4ec05f)
            #9 0x4ea318 in QJsonPrivate::Parser::parseMember() (/tmp/build-report/report+0x4ea318)
            #10 0x4e8b46 in QJsonPrivate::Parser::parseObject() (/tmp/build-report/report+0x4e8b46)
            #11 0x4e7250 in QJsonPrivate::Parser::parse(QJsonParseError*) (/tmp/build-report/report+0x4e7250)
            #12 0x4cfc7c in QJsonDocument::fromJson(QByteArray const&, QJsonParseError*) (/tmp/build-report/report+0x4cfc7c)
            #13 0x4cb89d in main (/tmp/build-report/report+0x4cb89d)
            #14 0x7fdcca4650b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
        
        SUMMARY: AddressSanitizer: 164 byte(s) leaked in 3 allocation(s).
        

        Attachments

        1. CMakeLists.txt
          0.3 kB
        2. main.cpp
          0.1 kB
        3. QTBUG-99799.json
          0.0 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            ulherman Ulf Hermann
            Reporter:
            rlohning Robert Löhning
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: