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

Unified Diff: runtime/bin/process.cc

Issue 11470017: Fix memory leaks in system string patch (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/process.cc
diff --git a/runtime/bin/process.cc b/runtime/bin/process.cc
index b642516f683ef00f93b95e41d225689e19381d55..822c4545eff0d6d4a0f842a0277c95c812569658 100644
--- a/runtime/bin/process.cc
+++ b/runtime/bin/process.cc
@@ -195,6 +195,7 @@ void FUNCTION_NAME(SystemEncodingToString)(Dart_NativeArguments args) {
char* str =
StringUtils::SystemStringToUtf8(reinterpret_cast<char*>(buffer));
Dart_SetReturnValue(args, DartUtils::NewString(str));
+ if (str != reinterpret_cast<char*>(buffer)) free(str);
Dart_ExitScope();
}
@@ -208,6 +209,7 @@ void FUNCTION_NAME(StringToSystemEncoding)(Dart_NativeArguments args) {
uint8_t* buffer = NULL;
Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer);
memmove(buffer, system_string, external_length);
+ if (utf8 != system_string) free(const_cast<char*>(system_string));
Dart_SetReturnValue(args, external_array);
Dart_ExitScope();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698