1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

bug fixes

This commit is contained in:
Werner Koch 1998-02-27 17:51:28 +00:00
parent 4e8c3794b3
commit b13e238a19
24 changed files with 466 additions and 260 deletions

View file

@ -219,6 +219,25 @@ secmem_malloc( size_t size )
}
void *
secmem_realloc( void *p, size_t newsize )
{
MEMBLOCK *mb;
size_t size;
void *a;
mb = (MEMBLOCK*)((char*)p - ((size_t) &((MEMBLOCK*)0)->u.d));
size = mb->size;
if( newsize < size )
return p; /* it is easier not to shrink the memory */
a = secmem_malloc( newsize );
memcpy(a, p, size);
memset(a+size, 0, newsize-size);
secmem_free(p);
return a;
}
void
secmem_free( void *a )
{
@ -241,6 +260,12 @@ secmem_free( void *a )
cur_alloced -= size;
}
int
m_is_secure( const void *p )
{
return p >= pool && p < (pool+poolsize);
}
void
secmem_term()
{