diff options
Diffstat (limited to 'mpi/mpiutil.c')
-rw-r--r-- | mpi/mpiutil.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mpi/mpiutil.c b/mpi/mpiutil.c index 89a84e94..2a0bafab 100644 --- a/mpi/mpiutil.c +++ b/mpi/mpiutil.c @@ -78,7 +78,12 @@ _gcry_mpi_alloc_limb_space( unsigned int nlimbs, int secure ) size_t len = nlimbs * sizeof(mpi_limb_t); mpi_ptr_t p = NULL; - if (nlimbs) + if (!nlimbs) + { + p = secure? gcry_xmalloc_secure( 1 ) : gcry_xmalloc( 1 ); + *p = 0; + } + else p = secure? gcry_xmalloc_secure( len ) : gcry_xmalloc( len ); return p; |