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

Unified Diff: runtime/bin/socket_linux.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_android.cc ('k') | runtime/bin/socket_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_linux.cc
diff --git a/runtime/bin/socket_linux.cc b/runtime/bin/socket_linux.cc
index 976bd0fb483aef539b8a06733c64cfb328c26d38..575da3bebc38cd62fe1bbffa8d2f72aa05657222 100644
--- a/runtime/bin/socket_linux.cc
+++ b/runtime/bin/socket_linux.cc
@@ -5,6 +5,9 @@
#include "platform/globals.h"
#if defined(TARGET_OS_LINUX)
+#include "bin/socket.h"
+#include "bin/socket_linux.h"
+
#include <errno.h> // NOLINT
#include <stdio.h> // NOLINT
#include <stdlib.h> // NOLINT
@@ -17,11 +20,9 @@
#include "bin/fdutils.h"
#include "bin/file.h"
-#include "bin/socket.h"
#include "bin/thread.h"
#include "platform/signal_blocker.h"
-
namespace dart {
namespace bin {
@@ -355,8 +356,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_android.cc ('k') | runtime/bin/socket_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698