diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-12-05 22:13:14 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-12-05 22:13:14 +0000 |
commit | 3a6627cad934d7ed96e2b96eda7dc3a490c9a1ec (patch) | |
tree | 2c31257cbc413b5762d2f3c237059032e0eac329 /src/scalarproduct | |
parent | fcc2a4d8d007e28143bff03d72beb1285898d829 (diff) | |
download | gnunet-3a6627cad934d7ed96e2b96eda7dc3a490c9a1ec.tar.gz gnunet-3a6627cad934d7ed96e2b96eda7dc3a490c9a1ec.zip |
-trying to fix leaks
Diffstat (limited to 'src/scalarproduct')
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/scalarproduct/gnunet-service-scalarproduct.c b/src/scalarproduct/gnunet-service-scalarproduct.c index 7a8cad850..fb1b8ab88 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct.c +++ b/src/scalarproduct/gnunet-service-scalarproduct.c | |||
@@ -1341,7 +1341,8 @@ compute_service_response (struct ServiceSession * request, | |||
1341 | GNUNET_free (rand_pi); | 1341 | GNUNET_free (rand_pi); |
1342 | 1342 | ||
1343 | // Calculate Kq = E(S + a_qi) (+) E(S - r_qi) | 1343 | // Calculate Kq = E(S + a_qi) (+) E(S - r_qi) |
1344 | for (i = 0; i < count; i++) { | 1344 | for (i = 0; i < count; i++) |
1345 | { | ||
1345 | // E(S - r_qi) | 1346 | // E(S - r_qi) |
1346 | gcry_mpi_sub (r_prime[i], my_offset, rand_pi_prime[i]); | 1347 | gcry_mpi_sub (r_prime[i], my_offset, rand_pi_prime[i]); |
1347 | encrypt_element (r_prime[i], r_prime[i], remote_g, remote_n, remote_nsquare); | 1348 | encrypt_element (r_prime[i], r_prime[i], remote_g, remote_n, remote_nsquare); |
@@ -1383,15 +1384,25 @@ compute_service_response (struct ServiceSession * request, | |||
1383 | ret = GNUNET_OK; | 1384 | ret = GNUNET_OK; |
1384 | 1385 | ||
1385 | except: | 1386 | except: |
1386 | for (i = 0; i < count; i++) { | 1387 | for (i = 0; i < count; i++) |
1388 | { | ||
1387 | gcry_mpi_release (b[i]); | 1389 | gcry_mpi_release (b[i]); |
1388 | gcry_mpi_release (request->a[i]); | 1390 | gcry_mpi_release (request->a[i]); |
1391 | gcry_mpi_release (rand[i]); | ||
1392 | gcry_mpi_release (r[i]); | ||
1393 | gcry_mpi_release (r_prime[i]); | ||
1389 | } | 1394 | } |
1390 | 1395 | ||
1391 | GNUNET_free (b); | 1396 | GNUNET_free (b); |
1392 | GNUNET_free (request->a); | 1397 | GNUNET_free (request->a); |
1393 | request->a = NULL; | 1398 | request->a = NULL; |
1394 | 1399 | GNUNET_free (p); | |
1400 | GNUNET_free (q); | ||
1401 | GNUNET_free (a_pi); | ||
1402 | GNUNET_free (rand); | ||
1403 | GNUNET_free (rand_pi); | ||
1404 | GNUNET_free (r); | ||
1405 | GNUNET_free (r_prime); | ||
1395 | return ret; | 1406 | return ret; |
1396 | } | 1407 | } |
1397 | 1408 | ||
@@ -1437,7 +1448,8 @@ prepare_service_request_multipart (void *cls) | |||
1437 | a = gcry_mpi_new (KEYBITS * 2); | 1448 | a = gcry_mpi_new (KEYBITS * 2); |
1438 | current = (unsigned char *) &msg[1]; | 1449 | current = (unsigned char *) &msg[1]; |
1439 | // encrypt our vector and generate string representations | 1450 | // encrypt our vector and generate string representations |
1440 | for (i = session->last_processed, j = 0; i < session->total; i++) { | 1451 | for (i = session->last_processed, j = 0; i < session->total; i++) |
1452 | { | ||
1441 | // is this a used element? | 1453 | // is this a used element? |
1442 | if (session->mask[i / 8] & 1 << (i % 8)) { | 1454 | if (session->mask[i / 8] & 1 << (i % 8)) { |
1443 | if (todo_count <= j) | 1455 | if (todo_count <= j) |