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

Side by Side Diff: runtime/bin/main.cc

Issue 819363002: Fix leak from new/free mismatch in main. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <string.h> 6 #include <string.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "include/dart_api.h" 9 #include "include/dart_api.h"
10 #include "include/dart_debugger_api.h" 10 #include "include/dart_debugger_api.h"
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 } 1147 }
1148 1148
1149 // Free environment if any. 1149 // Free environment if any.
1150 if (environment != NULL) { 1150 if (environment != NULL) {
1151 for (HashMap::Entry* p = environment->Start(); 1151 for (HashMap::Entry* p = environment->Start();
1152 p != NULL; 1152 p != NULL;
1153 p = environment->Next(p)) { 1153 p = environment->Next(p)) {
1154 free(p->key); 1154 free(p->key);
1155 free(p->value); 1155 free(p->value);
1156 } 1156 }
1157 free(environment); 1157 delete environment;
1158 } 1158 }
1159 1159
1160 exit(Process::GlobalExitCode()); 1160 exit(Process::GlobalExitCode());
1161 } 1161 }
1162 1162
1163 } // namespace bin 1163 } // namespace bin
1164 } // namespace dart 1164 } // namespace dart
1165 1165
1166 int main(int argc, char** argv) { 1166 int main(int argc, char** argv) {
1167 dart::bin::main(argc, argv); 1167 dart::bin::main(argc, argv);
1168 UNREACHABLE(); 1168 UNREACHABLE();
1169 } 1169 }
OLDNEW
« 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