[cfe-commits] r50945 - /cfe/trunk/lib/AST/DeclObjC.cpp

Nuno Lopes nunoplopes at sapo.pt
Sat May 10 03:31:55 PDT 2008


Author: nlopes
Date: Sat May 10 05:31:54 2008
New Revision: 50945

URL: http://llvm.org/viewvc/llvm-project?rev=50945&view=rev
Log:
fix free/delete mismatch problem in add/mergeProperties (found by valgrind)

Modified:
    cfe/trunk/lib/AST/DeclObjC.cpp

Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=50945&r1=50944&r2=50945&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Sat May 10 05:31:54 2008
@@ -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);
   }
 }
 





More information about the cfe-commits mailing list