#include <pthread.h>
#if HAVE_LIBGCRYPT
-# include <pthread.h>
# if defined __APPLE__
/* default xcode compiler throws warnings even when deprecated functionality
* is not used. -Werror breaks the build because of erroneous warnings.
#if HAVE_LIBGCRYPT
# if GCRYPT_VERSION_NUMBER < 0x010600
- gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+ if (gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread))
+ return (0);
# endif
if (!gcry_check_version (GCRYPT_VERSION))
return (0);
- gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0);
+ if (!gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0))
+ return (0);
+
gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
result = 1;
return (NULL);
}
- nb = malloc (sizeof (*nb));
+ nb = calloc (1, sizeof (*nb));
if (nb == NULL)
return (NULL);
- memset (nb, 0, sizeof (*nb));
nb->size = size;
- nb->buffer = malloc (nb->size);
+ nb->buffer = calloc (1, nb->size);
if (nb->buffer == NULL)
{
free (nb);
return (NULL);
}
- memset (nb->buffer, 0, nb->size);
nb->ptr = nb->buffer;
nb->free = nb->size;