Fixed valgrind errors so the fuzz test can be run under valgrind.
BUG=
TEST=
Review URL: https://webrtc-codereview.appspot.com/576008
git-svn-id: http://webrtc.googlecode.com/svn/trunk@2228 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/src/modules/udp_transport/source/udp_transport_impl.cc b/src/modules/udp_transport/source/udp_transport_impl.cc
index 5abc970..7c82e73 100644
--- a/src/modules/udp_transport/source/udp_transport_impl.cc
+++ b/src/modules/udp_transport/source/udp_transport_impl.cc
@@ -2478,7 +2478,7 @@
{
continue;
}
- if(n_localIP[0] == 0xfe &&
+ if(n_localIP[0] == 0xfe &&
n_localIP[1] == 0x80 && ptr->ai_next)
{
continue;
@@ -2505,11 +2505,11 @@
{
if(ptrIfAddrs->ifa_addr->sa_family == AF_INET6)
{
- const struct sockaddr_in6* sock_in6 =
+ const struct sockaddr_in6* sock_in6 =
reinterpret_cast<struct sockaddr_in6*>(ptrIfAddrs->ifa_addr);
const struct in6_addr* sin6_addr = &sock_in6->sin6_addr;
- if (IN6_IS_ADDR_LOOPBACK(sin6_addr) ||
+ if (IN6_IS_ADDR_LOOPBACK(sin6_addr) ||
IN6_IS_ADDR_LINKLOCAL(sin6_addr)) {
ptrIfAddrs = ptrIfAddrs->ifa_next;
continue;
@@ -2726,7 +2726,6 @@
++size;
// Buffer size needed is unknown. Try increasing it until no overflow
// occurs.
- // TODO(pwestin) memory leak
if (NULL == (ifc.ifc_req = (ifreq*)realloc(ifc.ifc_req, IFRSIZE))) {
fprintf(stderr, "Out of memory.\n");
exit(EXIT_FAILURE);
@@ -2734,6 +2733,7 @@
ifc.ifc_len = IFRSIZE;
if (ioctl(sockfd, SIOCGIFCONF, &ifc))
{
+ free(ifc.ifc_req);
close(sockfd);
return -1;
}
@@ -2760,9 +2760,11 @@
saddr);
localIP = Htonl(socket_addess->_sockaddr_in.sin_addr);
close(sockfd);
+ free(ifc.ifc_req);
return 0;
}
}
+ free(ifc.ifc_req);
close(sockfd);
return -1;
#endif
diff --git a/src/video_engine/test/auto_test/source/vie_autotest_linux.cc b/src/video_engine/test/auto_test/source/vie_autotest_linux.cc
index aca96bd..8a99c03 100644
--- a/src/video_engine/test/auto_test/source/vie_autotest_linux.cc
+++ b/src/video_engine/test/auto_test/source/vie_autotest_linux.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@@ -129,6 +129,7 @@
XUnmapWindow(display, *window);
XDestroyWindow(display, *window);
XSync(display, false);
+ XCloseDisplay(display);
return 0;
}
diff --git a/src/video_engine/vie_sender.cc b/src/video_engine/vie_sender.cc
index e0fe29b..cee4086 100644
--- a/src/video_engine/vie_sender.cc
+++ b/src/video_engine/vie_sender.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@@ -59,7 +59,7 @@
return -1;
}
if (encryption_buffer_) {
- delete encryption_buffer_;
+ delete[] encryption_buffer_;
encryption_buffer_ = NULL;
}
external_encryption_ = NULL;