rsaenh: Replace malloc() with HeapAlloc()

Andrew Talbot andrew.talbot at talbotville.com
Mon Feb 9 16:24:22 CST 2009


Changelog:
    rsaenh: Replace malloc() with HeapAlloc().

diff --git a/dlls/rsaenh/mpi.c b/dlls/rsaenh/mpi.c
index 0eb91f3..b51ed4e 100644
--- a/dlls/rsaenh/mpi.c
+++ b/dlls/rsaenh/mpi.c
@@ -30,6 +30,8 @@
 
 #include <stdarg.h>
 #include "tomcrypt.h"
+#include "windef.h"
+#include "winbase.h"
 
 /* Known optimal configurations
  CPU                    /Compiler     /MUL CUTOFF/SQR CUTOFF
@@ -154,7 +156,7 @@ static int mp_init (mp_int * a)
   int i;
 
   /* allocate memory required and clear it */
-  a->dp = malloc (sizeof (mp_digit) * MP_PREC);
+  a->dp = HeapAlloc (GetProcessHeap(), 0, sizeof (mp_digit) * MP_PREC);
   if (a->dp == NULL) {
     return MP_MEM;
   }
@@ -182,7 +184,7 @@ static int mp_init_size (mp_int * a, int size)
   size += (MP_PREC * 2) - (size % MP_PREC);
 
   /* alloc mem */
-  a->dp = malloc (sizeof (mp_digit) * size);
+  a->dp = HeapAlloc (GetProcessHeap(), 0, sizeof (mp_digit) * size);
   if (a->dp == NULL) {
     return MP_MEM;
   }
@@ -3378,7 +3380,7 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback
    bsize = (size>>3)+((size&7)?1:0);
 
    /* we need a buffer of bsize bytes */
-   tmp = malloc(bsize);
+   tmp = HeapAlloc(GetProcessHeap(), 0, bsize);
    if (tmp == NULL) {
       return MP_MEM;
    }



More information about the wine-patches mailing list