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

Unified Diff: runtime/bin/socket_macos.cc

Issue 1781883002: Fixes some memory leaks in //runtime/bin (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix tests on Windows Created 4 years, 9 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/bin/socket_linux.cc ('k') | runtime/bin/socket_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_macos.cc
diff --git a/runtime/bin/socket_macos.cc b/runtime/bin/socket_macos.cc
index 205793bc11689161d110091970eb11f8c7faff9f..22613d5e1890f48117840811262fe68cc4ac8b87 100644
--- a/runtime/bin/socket_macos.cc
+++ b/runtime/bin/socket_macos.cc
@@ -5,6 +5,9 @@
#include "platform/globals.h"
#if defined(TARGET_OS_MACOS)
+#include "bin/socket.h"
+#include "bin/socket_macos.h"
+
#include <errno.h> // NOLINT
#include <stdio.h> // NOLINT
#include <stdlib.h> // NOLINT
@@ -17,11 +20,8 @@
#include "bin/fdutils.h"
#include "bin/file.h"
-#include "bin/socket.h"
-
#include "platform/signal_blocker.h"
-
namespace dart {
namespace bin {
@@ -359,8 +359,9 @@ AddressList<InterfaceSocketAddress>* Socket::ListInterfaces(
int i = 0;
for (struct ifaddrs* ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
if (ShouldIncludeIfaAddrs(ifa, lookup_family)) {
+ char* ifa_name = DartUtils::ScopedCopyCString(ifa->ifa_name);
addresses->SetAt(i, new InterfaceSocketAddress(
- ifa->ifa_addr, strdup(ifa->ifa_name), if_nametoindex(ifa->ifa_name)));
+ ifa->ifa_addr, ifa_name, if_nametoindex(ifa->ifa_name)));
i++;
}
}
« no previous file with comments | « runtime/bin/socket_linux.cc ('k') | runtime/bin/socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698