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
This commit is contained in:
phoglund@webrtc.org 2012-05-11 07:36:53 +00:00
parent 799980fcaa
commit 7eadad6d95
3 changed files with 10 additions and 7 deletions

View File

@ -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<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 @@ 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

View File

@ -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;
}

View File

@ -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;