浏览代码

BUG: Fix memory leak when cmTarget instances are assigned. We really need to get rid of global targets and their associated assignments.

Brad King 17 年之前
父节点
当前提交
96ee85d197
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      Source/cmTarget.cxx

+ 2 - 0
Source/cmTarget.cxx

@@ -3543,6 +3543,8 @@ cmTargetInternalPointer::operator=(cmTargetInternalPointer const& r)
   // Ideally cmTarget instances should never be copied.  However until
   // we can make a sweep to remove that, this copy constructor avoids
   // allowing the resources (Internals) to be copied.
+  cmTargetInternals* oldPointer = this->Pointer;
   this->Pointer = new cmTargetInternals;
+  delete oldPointer;
   return *this;
 }