# HG changeset patch # User Matt Johnston # Date 1104685766 0 # Node ID 8e94663164c6e106ccc5c9e997dedf6e04d77dd2 # Parent 3a616069cc2161829e5078904fdc1d2b1c13ab6d make pointers volatile so that memory zeroing won't get optimised away diff -r 3a616069cc21 -r 8e94663164c6 bn_mp_clear.c --- a/bn_mp_clear.c Wed Dec 22 16:13:44 2004 +0000 +++ b/bn_mp_clear.c Sun Jan 02 17:09:26 2005 +0000 @@ -19,14 +19,17 @@ void mp_clear (mp_int * a) { - int i; + volatile mp_digit *p; + int len; /* only do anything if a hasn't been freed previously */ if (a->dp != NULL) { /* first zero the digits */ - for (i = 0; i < a->used; i++) { - a->dp[i] = 0; - } + len = a->alloc; + p = a->dp; + while (len--) { + *p++ = 0; + } /* free ram */ XFREE(a->dp);