Use calloc instead of malloc to pacify valgrind.
This commit is contained in:
@@ -79,7 +79,10 @@ if [[ $TRAVIS_OS_NAME == osx ]]; then
|
|||||||
fi
|
fi
|
||||||
upx=$PWD/upx.out
|
upx=$PWD/upx.out
|
||||||
if [[ $B =~ (^|\+)valgrind($|\+) ]]; then
|
if [[ $B =~ (^|\+)valgrind($|\+) ]]; then
|
||||||
upx="valgrind --leak-check=full --show-reachable=yes $upx"
|
valgrind_flags="--leak-check=full --show-reachable=yes"
|
||||||
|
valgrind_flags="-q --leak-check=no --error-exitcode=1"
|
||||||
|
valgrind_flags="--leak-check=no --error-exitcode=1"
|
||||||
|
upx="valgrind $valgrind_flags $upx"
|
||||||
fi
|
fi
|
||||||
upx_391=
|
upx_391=
|
||||||
if [[ $TRAVIS_OS_NAME == linux ]]; then
|
if [[ $TRAVIS_OS_NAME == linux ]]; then
|
||||||
|
|||||||
@@ -29,7 +29,10 @@ if [[ $TRAVIS_OS_NAME == osx ]]; then
|
|||||||
fi
|
fi
|
||||||
upx=$PWD/upx.out
|
upx=$PWD/upx.out
|
||||||
if [[ $B =~ (^|\+)valgrind($|\+) ]]; then
|
if [[ $B =~ (^|\+)valgrind($|\+) ]]; then
|
||||||
upx="valgrind --leak-check=full --show-reachable=yes $upx"
|
valgrind_flags="--leak-check=full --show-reachable=yes"
|
||||||
|
valgrind_flags="-q --leak-check=no --error-exitcode=1"
|
||||||
|
valgrind_flags="--leak-check=no --error-exitcode=1"
|
||||||
|
upx="valgrind $valgrind_flags $upx"
|
||||||
fi
|
fi
|
||||||
upx_391=
|
upx_391=
|
||||||
if [[ $TRAVIS_OS_NAME == linux ]]; then
|
if [[ $TRAVIS_OS_NAME == linux ]]; then
|
||||||
|
|||||||
@@ -281,6 +281,11 @@ int upx_ucl_test_overlap ( const upx_bytep buf,
|
|||||||
// misc
|
// misc
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
static ucl_voidp __UCL_CDECL my_malloc(ucl_uint n) { return calloc(1, n); }
|
||||||
|
static void __UCL_CDECL my_free(ucl_voidp p) { free(p); }
|
||||||
|
}
|
||||||
|
|
||||||
int upx_ucl_init(void)
|
int upx_ucl_init(void)
|
||||||
{
|
{
|
||||||
if (ucl_init() != UCL_E_OK)
|
if (ucl_init() != UCL_E_OK)
|
||||||
@@ -289,6 +294,7 @@ int upx_ucl_init(void)
|
|||||||
if (UCL_VERSION != ucl_version())
|
if (UCL_VERSION != ucl_version())
|
||||||
return -2;
|
return -2;
|
||||||
#endif
|
#endif
|
||||||
|
ucl_set_malloc_hooks(my_malloc, my_free);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user