fix free/delete mismatch problem in add/mergeProperties (found by valgrind)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50945 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index cda73d2..701ad35 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -260,14 +260,12 @@
// 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);
}
}