aboutsummaryrefslogtreecommitdiffstats
path: root/util/secmem.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1999-02-26 16:59:48 +0000
committerWerner Koch <[email protected]>1999-02-26 16:59:48 +0000
commit694099b9af96d53ad4a4f9bc70e08c2f393f9f4e (patch)
treeff5ddc557b85093cbf4076374bd43b2e958ce804 /util/secmem.c
parentSee ChangeLog: Thu Feb 25 18:47:39 CET 1999 Werner Koch (diff)
downloadgnupg-694099b9af96d53ad4a4f9bc70e08c2f393f9f4e.tar.gz
gnupg-694099b9af96d53ad4a4f9bc70e08c2f393f9f4e.zip
See ChangeLog: Fri Feb 26 17:55:41 CET 1999 Werner Koch
Diffstat (limited to 'util/secmem.c')
-rw-r--r--util/secmem.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/util/secmem.c b/util/secmem.c
index aa6d822c7..3db66c062 100644
--- a/util/secmem.c
+++ b/util/secmem.c
@@ -47,8 +47,7 @@ struct memblock_struct {
unsigned size;
union {
MEMBLOCK *next;
- long align_dummy;
- char d[1];
+ PROPERLY_ALIGNED_TYPE aligned;
} u;
};
@@ -291,7 +290,7 @@ secmem_malloc( size_t size )
max_alloced = cur_alloced;
if( cur_blocks > max_blocks )
max_blocks = cur_blocks;
- return &mb->u.d;
+ return &mb->u.aligned.c;
}
@@ -302,7 +301,7 @@ secmem_realloc( void *p, size_t newsize )
size_t size;
void *a;
- mb = (MEMBLOCK*)((char*)p - ((size_t) &((MEMBLOCK*)0)->u.d));
+ mb = (MEMBLOCK*)((char*)p - ((size_t) &((MEMBLOCK*)0)->u.aligned.c));
size = mb->size;
if( newsize < size )
return p; /* it is easier not to shrink the memory */
@@ -323,7 +322,7 @@ secmem_free( void *a )
if( !a )
return;
- mb = (MEMBLOCK*)((char*)a - ((size_t) &((MEMBLOCK*)0)->u.d));
+ mb = (MEMBLOCK*)((char*)a - ((size_t) &((MEMBLOCK*)0)->u.aligned.c));
size = mb->size;
memset(mb, 0xff, size );
memset(mb, 0xaa, size );