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

QFileSystemWatcher dnotify implementation leaks memory

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P1: Critical P1: Critical
    • 4.6.1
    • 4.5.3
    • Core: I/O
    • None

      The QFileSystemWatcher dnotify implementation is leaking memory.
      Compile the attached program and run with valgrind.
      NOTE: the program forces set the object name of the QFileSystemWatcher to force the dnotiy implementation.
      QFileDialog uses the QFileSystemWatcher resulting in lots of memory leaks when opening files in the application.

      The problem is that there are opendir calls without closedir.

      FILE: qfilesystemwatcher_dnotify.cpp

      In function: QDnotifyFileSystemWatcherEngine::addPaths you can see there are opendir calls but if the
      'if statement at line 276' is not true then there are no closedir calls.

      I believe the following two lines should be inserted between line 297 - 298:

      ::closedir(d);
      if(parent) ::closedir(parent);

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

            bhughes Bradley T. Hughes (closed Nokia Identity) (Inactive)
            janichol Andy Nichols
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes