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

Memory leak in QStandardPaths::displayName()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.9.3, 5.10.0
    • None
    • macOS 10.12.6
    • 13c71ac816ce2f7fe864d6213b790a424d9a1664

    Description

      QStandardPaths::displayName() function in qtbase/src/corelib/io/qstandardpaths_mac.mm leaks CFString instance in following block of code (line 235):

      if (QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
      standardLocations(type).constFirst().toCFString(),
      kCFURLPOSIXPathStyle, true)) {
          QCFString name;
          CFURLCopyResourcePropertyForKey(url, kCFURLLocalizedNameKey, &name, NULL);
          if (name && CFStringGetLength(name))
              return QString::fromCFString(name);
      }
      

      calling standardLocations(type).constFirst().toCFString() passes ownership of the string to the caller but the caller does not release the string.

      Attachments

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

        Activity

          People

            jakepetroules Jake Petroules (DO NOT ASSIGN ISSUES)
            pavol.markovic Pavol Markovic
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes