make pointers volatile so that memory zeroing won't get optimised away

--HG--
branch : libtommath
extra : convert_revision : e0186764b7d023da96c6f248b0378af701d3c7c4
This commit is contained in:
Matt Johnston
2005-01-02 17:09:26 +00:00
parent dd32d7d89e
commit 59b0174a5e

View File

@@ -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);