Merge pull request #1840 from hardening/valgrind

Adds some support for valgrind helpers
This commit is contained in:
Bernhard Miklautz 2014-05-19 16:23:06 +02:00
commit 29710ae74a
4 changed files with 19 additions and 0 deletions

View File

@ -345,6 +345,12 @@ if(NOT WIN32)
list(REMOVE_ITEM CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) list(REMOVE_ITEM CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
endif() endif()
if(WITH_VALGRIND_MEMCHECK)
check_include_files(valgrind/memcheck.h HAVE_VALGRIND_MEMCHECK_H)
else()
unset(HAVE_VALGRIND_MEMCHECK_H CACHE)
endif()
if(UNIX OR CYGWIN) if(UNIX OR CYGWIN)
check_include_files(sys/eventfd.h HAVE_AIO_H) check_include_files(sys/eventfd.h HAVE_AIO_H)
check_include_files(sys/eventfd.h HAVE_EVENTFD_H) check_include_files(sys/eventfd.h HAVE_EVENTFD_H)

View File

@ -44,6 +44,10 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_COMPILER_IS_CLANG 1) set(CMAKE_COMPILER_IS_CLANG 1)
endif() endif()
if(NOT WIN32)
option(WITH_VALGRIND_MEMCHECK "Compile with valgrind helpers." OFF)
endif()
if(MSVC) if(MSVC)
option(WITH_NATIVE_SSPI "Use native SSPI modules" ON) option(WITH_NATIVE_SSPI "Use native SSPI modules" ON)
option(WITH_WINMM "Use Windows Multimedia" ON) option(WITH_WINMM "Use Windows Multimedia" ON)

View File

@ -25,6 +25,7 @@
#cmakedefine HAVE_TM_GMTOFF #cmakedefine HAVE_TM_GMTOFF
#cmakedefine HAVE_AIO_H #cmakedefine HAVE_AIO_H
#cmakedefine HAVE_PTHREAD_GNU_EXT #cmakedefine HAVE_PTHREAD_GNU_EXT
#cmakedefine HAVE_VALGRIND_MEMCHECK_H
/* Options */ /* Options */

View File

@ -31,6 +31,10 @@
#include <freerdp/crypto/tls.h> #include <freerdp/crypto/tls.h>
#ifdef HAVE_VALGRIND_MEMCHECK_H
#include <valgrind/memcheck.h>
#endif
static CryptoCert tls_get_certificate(rdpTls* tls, BOOL peer) static CryptoCert tls_get_certificate(rdpTls* tls, BOOL peer)
{ {
CryptoCert cert; CryptoCert cert;
@ -465,6 +469,10 @@ int tls_read(rdpTls* tls, BYTE* data, int length)
} }
} }
#ifdef HAVE_VALGRIND_MEMCHECK_H
VALGRIND_MAKE_MEM_DEFINED(data, status);
#endif
return status; return status;
} }