Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Unified Diff: runtime/vm/proccpuinfo.cc

Issue 182883002: - Sort out confusion between malloc/free and new/delete. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/cpuid.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/proccpuinfo.cc
===================================================================
--- runtime/vm/proccpuinfo.cc (revision 33109)
+++ runtime/vm/proccpuinfo.cc (working copy)
@@ -38,7 +38,7 @@
}
// Read the contents of the cpuinfo file.
- data_ = new char[datalen_ + 1];
+ data_ = reinterpret_cast<char*>(malloc(datalen_ + 1));
fp = fopen(PATHNAME, "r");
if (fp != NULL) {
for (intptr_t offset = 0; offset < datalen_; ) {
@@ -58,7 +58,7 @@
void ProcCpuInfo::Cleanup() {
ASSERT(data_);
- delete[] data_;
+ free(data_);
data_ = NULL;
}
@@ -115,7 +115,7 @@
// Extract the content of a the first occurrence of a given field in
// the content of the cpuinfo file and return it as a heap-allocated
-// string that must be freed by the caller using delete[].
+// string that must be freed by the caller using free.
// Return NULL if not found.
const char* ProcCpuInfo::ExtractField(const char* field) {
ASSERT(field != NULL);
@@ -133,7 +133,7 @@
}
intptr_t len = q - p;
- char* result = new char[len + 1]; // plus one for null-terminator.
+ char* result = reinterpret_cast<char*>(malloc(len + 1));
// Copy the line into result, leaving enough room for a null-terminator.
char saved_end = *q;
*q = '\0';
« no previous file with comments | « runtime/vm/cpuid.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698