summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/authorization/anastasis_authorization_plugin_email.c7
-rw-r--r--src/authorization/anastasis_authorization_plugin_iban.c7
-rw-r--r--src/authorization/anastasis_authorization_plugin_post.c7
-rw-r--r--src/authorization/anastasis_authorization_plugin_sms.c7
-rw-r--r--src/backend/anastasis-httpd.c10
-rw-r--r--src/backend/anastasis-httpd.h5
-rw-r--r--src/backend/anastasis-httpd_truth.c22
-rw-r--r--src/reducer/anastasis_api_backup_redux.c22
-rw-r--r--src/reducer/anastasis_api_redux.c1
9 files changed, 67 insertions, 21 deletions
diff --git a/src/authorization/anastasis_authorization_plugin_email.c b/src/authorization/anastasis_authorization_plugin_email.c
index 3d42aa3..78c12ca 100644
--- a/src/authorization/anastasis_authorization_plugin_email.c
+++ b/src/authorization/anastasis_authorization_plugin_email.c
@@ -167,8 +167,10 @@ get_message (const json_t *messages,
NULL, NULL))
{
GNUNET_break (0);
+ GNUNET_JSON_parse_free (spec);
return NULL;
}
+ GNUNET_JSON_parse_free (spec);
return ret;
}
}
@@ -552,10 +554,13 @@ libanastasis_plugin_authorization_email_init (void *cls)
{
char *fn;
json_error_t err;
+ char *tmp;
+ tmp = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
GNUNET_asprintf (&fn,
"%sauthorization-email-messages.json",
- GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR));
+ tmp);
+ GNUNET_free (tmp);
ctx->messages = json_load_file (fn,
JSON_REJECT_DUPLICATES,
&err);
diff --git a/src/authorization/anastasis_authorization_plugin_iban.c b/src/authorization/anastasis_authorization_plugin_iban.c
index e70bfdd..62b1500 100644
--- a/src/authorization/anastasis_authorization_plugin_iban.c
+++ b/src/authorization/anastasis_authorization_plugin_iban.c
@@ -161,8 +161,10 @@ get_message (const json_t *messages,
NULL, NULL))
{
GNUNET_break (0);
+ GNUNET_JSON_parse_free (spec);
return NULL;
}
+ GNUNET_JSON_parse_free (spec);
return ret;
}
}
@@ -666,10 +668,13 @@ libanastasis_plugin_authorization_iban_init (void *cls)
{
char *fn;
json_error_t err;
+ char *tmp;
+ tmp = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
GNUNET_asprintf (&fn,
"%sauthorization-iban-messages.json",
- GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR));
+ tmp);
+ GNUNET_free (tmp);
ctx->messages = json_load_file (fn,
JSON_REJECT_DUPLICATES,
&err);
diff --git a/src/authorization/anastasis_authorization_plugin_post.c b/src/authorization/anastasis_authorization_plugin_post.c
index 30cea88..98dd042 100644
--- a/src/authorization/anastasis_authorization_plugin_post.c
+++ b/src/authorization/anastasis_authorization_plugin_post.c
@@ -162,8 +162,10 @@ get_message (const json_t *messages,
NULL, NULL))
{
GNUNET_break (0);
+ GNUNET_JSON_parse_free (spec);
return NULL;
}
+ GNUNET_JSON_parse_free (spec);
return ret;
}
}
@@ -606,10 +608,13 @@ libanastasis_plugin_authorization_post_init (void *cls)
{
char *fn;
json_error_t err;
+ char *tmp;
+ tmp = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
GNUNET_asprintf (&fn,
"%sauthorization-post-messages.json",
- GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR));
+ tmp);
+ GNUNET_free (tmp);
ctx->messages = json_load_file (fn,
JSON_REJECT_DUPLICATES,
&err);
diff --git a/src/authorization/anastasis_authorization_plugin_sms.c b/src/authorization/anastasis_authorization_plugin_sms.c
index df398fd..4922380 100644
--- a/src/authorization/anastasis_authorization_plugin_sms.c
+++ b/src/authorization/anastasis_authorization_plugin_sms.c
@@ -166,8 +166,10 @@ get_message (const json_t *messages,
NULL, NULL))
{
GNUNET_break (0);
+ GNUNET_JSON_parse_free (spec);
return NULL;
}
+ GNUNET_JSON_parse_free (spec);
return ret;
}
}
@@ -543,10 +545,13 @@ libanastasis_plugin_authorization_sms_init (void *cls)
{
char *fn;
json_error_t err;
+ char *tmp;
+ tmp = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
GNUNET_asprintf (&fn,
"%sauthorization-sms-messages.json",
- GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR));
+ tmp);
+ GNUNET_free (tmp);
ctx->messages = json_load_file (fn,
JSON_REJECT_DUPLICATES,
&err);
diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c
index 35a4d9c..fdf17ff 100644
--- a/src/backend/anastasis-httpd.c
+++ b/src/backend/anastasis-httpd.c
@@ -112,6 +112,11 @@ static int AH_connection_close;
static struct GNUNET_SCHEDULER_Task *mhd_task;
/**
+ * Heap for processing timeouts of requests.
+ */
+struct GNUNET_CONTAINER_Heap *AH_to_heap;
+
+/**
* Global return code
*/
static int global_result;
@@ -496,6 +501,11 @@ do_shutdown (void *cls)
ANASTASIS_DB_plugin_unload (db);
db = NULL;
}
+ if (NULL != AH_to_heap)
+ {
+ GNUNET_CONTAINER_heap_destroy (AH_to_heap);
+ AH_to_heap = NULL;
+ }
}
diff --git a/src/backend/anastasis-httpd.h b/src/backend/anastasis-httpd.h
index b84088d..33e0504 100644
--- a/src/backend/anastasis-httpd.h
+++ b/src/backend/anastasis-httpd.h
@@ -180,6 +180,11 @@ extern char *AH_backend_url;
extern char *AH_currency;
/**
+ * Heap for processing timeouts of requests.
+ */
+extern struct GNUNET_CONTAINER_Heap *AH_to_heap;
+
+/**
* Our configuration.
*/
extern const struct GNUNET_CONFIGURATION_Handle *AH_cfg;
diff --git a/src/backend/anastasis-httpd_truth.c b/src/backend/anastasis-httpd_truth.c
index aa3011b..df105dd 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -230,11 +230,6 @@ static struct GetContext *gc_head;
static struct GetContext *gc_tail;
/**
- * Heap for processing timeouts of requests.
- */
-static struct GNUNET_CONTAINER_Heap *to_heap;
-
-/**
* Task running #do_timeout().
*/
static struct GNUNET_SCHEDULER_Task *to_task;
@@ -253,7 +248,7 @@ do_timeout (void *cls)
(void) cls;
to_task = NULL;
while (NULL !=
- (gc = GNUNET_CONTAINER_heap_peek (to_heap)))
+ (gc = GNUNET_CONTAINER_heap_peek (AH_to_heap)))
{
if (GNUNET_TIME_absolute_is_future (gc->timeout))
break;
@@ -269,7 +264,7 @@ do_timeout (void *cls)
GNUNET_assert (NULL != gc->hn);
gc->hn = NULL;
GNUNET_assert (gc ==
- GNUNET_CONTAINER_heap_remove_root (to_heap));
+ GNUNET_CONTAINER_heap_remove_root (AH_to_heap));
}
if (NULL == gc)
return;
@@ -336,11 +331,6 @@ AH_truth_shutdown (void)
GNUNET_SCHEDULER_cancel (to_task);
to_task = NULL;
}
- if (NULL != to_heap)
- {
- GNUNET_CONTAINER_heap_destroy (to_heap);
- to_heap = NULL;
- }
}
@@ -931,10 +921,10 @@ run_authorization_process (struct MHD_Connection *connection,
return MHD_YES;
case ANASTASIS_AUTHORIZATION_RES_SUSPENDED:
/* connection was suspended */
- if (NULL == to_heap)
- to_heap = GNUNET_CONTAINER_heap_create (
+ if (NULL == AH_to_heap)
+ AH_to_heap = GNUNET_CONTAINER_heap_create (
GNUNET_CONTAINER_HEAP_ORDER_MIN);
- gc->hn = GNUNET_CONTAINER_heap_insert (to_heap,
+ gc->hn = GNUNET_CONTAINER_heap_insert (AH_to_heap,
gc,
gc->timeout.abs_value_us);
gc->suspended = true;
@@ -946,7 +936,7 @@ run_authorization_process (struct MHD_Connection *connection,
{
struct GetContext *rn;
- rn = GNUNET_CONTAINER_heap_peek (to_heap);
+ rn = GNUNET_CONTAINER_heap_peek (AH_to_heap);
to_task = GNUNET_SCHEDULER_add_at (rn->timeout,
&do_timeout,
NULL);
diff --git a/src/reducer/anastasis_api_backup_redux.c b/src/reducer/anastasis_api_backup_redux.c
index 27a79c0..e025810 100644
--- a/src/reducer/anastasis_api_backup_redux.c
+++ b/src/reducer/anastasis_api_backup_redux.c
@@ -835,6 +835,9 @@ eval_provider_selection (struct PolicyBuilder *pb,
unsigned int curr_diversity;
struct PolicyEntry policy_ent[pb->req_methods];
+ memset (policy_ent,
+ 0,
+ sizeof (policy_ent));
for (unsigned int i = 0; i < pb->req_methods; i++)
{
const json_t *method_obj = json_array_get (pb->methods,
@@ -869,7 +872,6 @@ eval_provider_selection (struct PolicyBuilder *pb,
};
policy_ent[i].provider_name = prov_sel[i];
- policy_ent[i].usage_fee = NULL;
if (GNUNET_OK !=
GNUNET_JSON_parse (method_obj,
mspec,
@@ -878,6 +880,8 @@ eval_provider_selection (struct PolicyBuilder *pb,
GNUNET_break (0);
pb->ec = TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID;
pb->hint = "'authentication_method' content malformed";
+ for (unsigned int i = 0; i<pb->req_methods; i++)
+ free_costs (policy_ent[i].usage_fee);
return;
}
@@ -886,6 +890,8 @@ eval_provider_selection (struct PolicyBuilder *pb,
"http_status")))
{
GNUNET_JSON_parse_free (mspec);
+ for (unsigned int i = 0; i<pb->req_methods; i++)
+ free_costs (policy_ent[i].usage_fee);
return; /* skip providers that are down */
}
if (GNUNET_OK !=
@@ -897,6 +903,8 @@ eval_provider_selection (struct PolicyBuilder *pb,
"Skipping provider %s: no suitable configuration\n",
prov_sel[i]);
GNUNET_JSON_parse_free (mspec);
+ for (unsigned int i = 0; i<pb->req_methods; i++)
+ free_costs (policy_ent[i].usage_fee);
return;
}
json_array_foreach (provider_methods, index, md)
@@ -920,6 +928,8 @@ eval_provider_selection (struct PolicyBuilder *pb,
pb->ec = TALER_EC_ANASTASIS_REDUCER_STATE_INVALID;
pb->hint = "'methods' of provider";
GNUNET_JSON_parse_free (pspec);
+ for (unsigned int i = 0; i<pb->req_methods; i++)
+ free_costs (policy_ent[i].usage_fee);
return;
}
if ( (0 == strcmp (type,
@@ -941,6 +951,8 @@ eval_provider_selection (struct PolicyBuilder *pb,
Cost is basically 'infinite', but we simply then skip this. */
GNUNET_JSON_parse_free (pspec);
GNUNET_JSON_parse_free (mspec);
+ for (unsigned int i = 0; i<pb->req_methods; i++)
+ free_costs (policy_ent[i].usage_fee);
return;
}
GNUNET_JSON_parse_free (mspec);
@@ -972,8 +984,12 @@ eval_provider_selection (struct PolicyBuilder *pb,
pb->best_diversity);
#endif
if (curr_diversity < pb->best_diversity)
+ {
+ for (unsigned int i = 0; i<pb->req_methods; i++)
+ free_costs (policy_ent[i].usage_fee);
return; /* do not allow combinations that are bad
for provider diversity */
+ }
if (curr_diversity > pb->best_diversity)
{
/* drop existing policies, they are all worse */
@@ -1016,7 +1032,11 @@ eval_provider_selection (struct PolicyBuilder *pb,
}
}
if (equiv)
+ {
+ for (unsigned int i = 0; i<pb->req_methods; i++)
+ free_costs (policy_ent[i].usage_fee);
return; /* equivalent to known allocation */
+ }
}
}
diff --git a/src/reducer/anastasis_api_redux.c b/src/reducer/anastasis_api_redux.c
index bd14285..6262033 100644
--- a/src/reducer/anastasis_api_redux.c
+++ b/src/reducer/anastasis_api_redux.c
@@ -349,6 +349,7 @@ free_config_request (struct ConfigRequest *cr)
GNUNET_free (cr->business_name);
for (unsigned int i = 0; i<cr->methods_length; i++)
GNUNET_free (cr->methods[i].type);
+ GNUNET_free (cr->business_name);
GNUNET_free (cr->methods);
GNUNET_free (cr);
}