]> granicus.if.org Git - clang/commitdiff
fix free/delete mismatch problem in add/mergeProperties (found by valgrind)
authorNuno Lopes <nunoplopes@sapo.pt>
Sat, 10 May 2008 10:31:54 +0000 (10:31 +0000)
committerNuno Lopes <nunoplopes@sapo.pt>
Sat, 10 May 2008 10:31:54 +0000 (10:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50945 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclObjC.cpp

index cda73d2ff9cdb0c2c579225c4b662fb971274a77..701ad353a3e92e67834f33d7db13223fc1365568 100644 (file)
@@ -260,14 +260,12 @@ void ObjCInterfaceDecl::mergeProperties(ObjCPropertyDecl **Properties,
     // Add new properties to this buffer.
     memcpy(buf+NumPropertyDecl, Properties, 
            NumNewProperties*sizeof(ObjCPropertyDecl*));
-    free(PropertyDecl);
+    delete[] PropertyDecl;
     PropertyDecl = newPropertyDecl;
     NumPropertyDecl += NumNewProperties;
   }
   else {
-    PropertyDecl = new ObjCPropertyDecl*[NumNewProperties];
-    memcpy(PropertyDecl, Properties, NumNewProperties*sizeof(ObjCPropertyDecl*));
-    NumPropertyDecl = NumNewProperties;
+    addProperties(Properties, NumNewProperties);
   }
 }