gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r1016 - GNUnet/src/util


From: grothoff
Subject: [GNUnet-SVN] r1016 - GNUnet/src/util
Date: Sat, 25 Jun 2005 14:41:52 -0700 (PDT)

Author: grothoff
Date: 2005-06-25 14:41:49 -0700 (Sat, 25 Jun 2005)
New Revision: 1016

Modified:
   GNUnet/src/util/kblockkey.c
   GNUnet/src/util/kblockkey_test.c
Log:
fixing memory leak

Modified: GNUnet/src/util/kblockkey.c
===================================================================
--- GNUnet/src/util/kblockkey.c 2005-06-25 19:45:45 UTC (rev 1015)
+++ GNUnet/src/util/kblockkey.c 2005-06-25 21:41:49 UTC (rev 1016)
@@ -391,6 +391,8 @@
 
   do {
     do {
+      mpz_clear(sk->p);
+      mpz_clear(sk->q);
       gen_prime(sk->p, nbits/2, hc);
       gen_prime(sk->q, nbits/2, hc);
 

Modified: GNUnet/src/util/kblockkey_test.c
===================================================================
--- GNUnet/src/util/kblockkey_test.c    2005-06-25 19:45:45 UTC (rev 1015)
+++ GNUnet/src/util/kblockkey_test.c    2005-06-25 21:41:49 UTC (rev 1016)
@@ -10,6 +10,7 @@
 
 #define TESTSTRING "Hello World\0"
 #define MAX_TESTVAL 20
+#define UNIQUE_ITER 6
 #define ITER 10
 
 
@@ -35,7 +36,7 @@
     printf("%02x", ((unsigned char*) &pkey)[i]);
     printf("\n"); */
   freePrivateKey(hostkey);
-  for (i=0;i<6;i++) {
+  for (i=0;i<UNIQUE_ITER;i++) {
     fprintf(stderr, ".");
     hostkey = makeKblockKey(&in);
     if (hostkey == NULL) {
@@ -185,8 +186,10 @@
       fprintf(stderr,
              "decryptPrivateKey returned SYSERR\n");
       ok = SYSERR;
+      freePrivateKey(hostkey);
       continue;
     }
+    freePrivateKey(hostkey);
     if (strncmp(TESTSTRING, result,
                strlen(TESTSTRING)) != 0) {
       printf("%s != %.*s - testEncryptDecrypt failed!\n",





reply via email to

[Prev in Thread] Current Thread [Next in Thread]