Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8234691

Potential double-free in ParallelSPCleanupTask constructor

XMLWordPrintable

    • b20

        The ParallelSPCleanupTask class has a SubTasksDone member _subtasks. The constructor for ParallelSPCleanupTask initializes that member in the initializer list to a freshly constructed rvalue SubTasksDone.

        Fortunately, that extra SubTasksDone object is completely optimized away via RVO on most or all platforms, since SubTasksDone presently has a default copy constructor. Without the RVO optimization we'd have a double-free of the internal array in the SubTasksDone object that gets constructed by the normal constructor and deleted by the destructor. (SubTasksDone probably ought to be noncopyable; that would have prevented the problem code from compiling in the first place.)

              dbuck David Buck
              kbarrett Kim Barrett
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: