Use calloc instead of malloc to pacify valgrind.

This commit is contained in:
Markus F.X.J. Oberhumer
2016-09-28 21:30:38 +02:00
parent b0841268bd
commit e41c475671
3 changed files with 14 additions and 2 deletions
+6
View File
@@ -281,6 +281,11 @@ int upx_ucl_test_overlap ( const upx_bytep buf,
// 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)
{
if (ucl_init() != UCL_E_OK)
@@ -289,6 +294,7 @@ int upx_ucl_init(void)
if (UCL_VERSION != ucl_version())
return -2;
#endif
ucl_set_malloc_hooks(my_malloc, my_free);
return 0;
}