diff --git a/src/modules/udp_transport/source/udp_transport_impl.cc b/src/modules/udp_transport/source/udp_transport_impl.cc index 5abc97065..7c82e73e2 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 @@ WebRtc_Word32 UdpTransport::LocalHostAddressIPV6(char n_localIP[16]) { continue; } - if(n_localIP[0] == 0xfe && + if(n_localIP[0] == 0xfe && n_localIP[1] == 0x80 && ptr->ai_next) { continue; @@ -2505,11 +2505,11 @@ WebRtc_Word32 UdpTransport::LocalHostAddressIPV6(char n_localIP[16]) { if(ptrIfAddrs->ifa_addr->sa_family == AF_INET6) { - const struct sockaddr_in6* sock_in6 = + const struct sockaddr_in6* sock_in6 = reinterpret_cast(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 @@ WebRtc_Word32 UdpTransport::LocalHostAddress(WebRtc_UWord32& localIP) ++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 @@ WebRtc_Word32 UdpTransport::LocalHostAddress(WebRtc_UWord32& localIP) ifc.ifc_len = IFRSIZE; if (ioctl(sockfd, SIOCGIFCONF, &ifc)) { + free(ifc.ifc_req); close(sockfd); return -1; } @@ -2760,9 +2760,11 @@ WebRtc_Word32 UdpTransport::LocalHostAddress(WebRtc_UWord32& localIP) 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 aca96bd07..8a99c032b 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 @@ int ViEAutoTestWindowManager::ViEDestroyWindow(Window *window, 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 e0fe29bda..cee408651 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 @@ int ViESender::DeregisterExternalEncryption() { return -1; } if (encryption_buffer_) { - delete encryption_buffer_; + delete[] encryption_buffer_; encryption_buffer_ = NULL; } external_encryption_ = NULL;