-fix uninitialized variable and memory leak
This commit is contained in:
parent
faca037018
commit
647ae694cc
@ -490,8 +490,6 @@ initiate_task (void *cls)
|
|||||||
struct PluginState *ps = pd->ps;
|
struct PluginState *ps = pd->ps;
|
||||||
char *hps;
|
char *hps;
|
||||||
char *url;
|
char *url;
|
||||||
char *redirect_uri;
|
|
||||||
char *redirect_uri_encoded;
|
|
||||||
char legi_s[42];
|
char legi_s[42];
|
||||||
|
|
||||||
ih->task = NULL;
|
ih->task = NULL;
|
||||||
@ -501,6 +499,12 @@ initiate_task (void *cls)
|
|||||||
(unsigned long long) ih->legitimization_uuid);
|
(unsigned long long) ih->legitimization_uuid);
|
||||||
hps = GNUNET_STRINGS_data_to_string_alloc (&ih->h_payto,
|
hps = GNUNET_STRINGS_data_to_string_alloc (&ih->h_payto,
|
||||||
sizeof (ih->h_payto));
|
sizeof (ih->h_payto));
|
||||||
|
{
|
||||||
|
char *redirect_uri_encoded;
|
||||||
|
|
||||||
|
{
|
||||||
|
char *redirect_uri;
|
||||||
|
|
||||||
GNUNET_asprintf (&redirect_uri,
|
GNUNET_asprintf (&redirect_uri,
|
||||||
"%skyc-proof/%s?state=%s",
|
"%skyc-proof/%s?state=%s",
|
||||||
ps->exchange_base_url,
|
ps->exchange_base_url,
|
||||||
@ -508,12 +512,14 @@ initiate_task (void *cls)
|
|||||||
hps);
|
hps);
|
||||||
redirect_uri_encoded = TALER_urlencode (redirect_uri);
|
redirect_uri_encoded = TALER_urlencode (redirect_uri);
|
||||||
GNUNET_free (redirect_uri);
|
GNUNET_free (redirect_uri);
|
||||||
|
}
|
||||||
GNUNET_asprintf (&url,
|
GNUNET_asprintf (&url,
|
||||||
"%s?response_type=code&client_id=%s&redirect_uri=%s",
|
"%s?response_type=code&client_id=%s&redirect_uri=%s",
|
||||||
pd->login_url,
|
pd->login_url,
|
||||||
pd->client_id,
|
pd->client_id,
|
||||||
redirect_uri_encoded);
|
redirect_uri_encoded);
|
||||||
GNUNET_free (redirect_uri_encoded);
|
GNUNET_free (redirect_uri_encoded);
|
||||||
|
}
|
||||||
/* FIXME-API: why do we *redirect* the client here,
|
/* FIXME-API: why do we *redirect* the client here,
|
||||||
instead of making the HTTP request *ourselves*
|
instead of making the HTTP request *ourselves*
|
||||||
and forwarding the response? This prevents us
|
and forwarding the response? This prevents us
|
||||||
@ -582,6 +588,37 @@ oauth2_initiate_cancel (struct TALER_KYCLOGIC_InitiateHandle *ih)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel KYC proof.
|
||||||
|
*
|
||||||
|
* @param[in] ph handle of operation to cancel
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
oauth2_proof_cancel (struct TALER_KYCLOGIC_ProofHandle *ph)
|
||||||
|
{
|
||||||
|
if (NULL != ph->task)
|
||||||
|
{
|
||||||
|
GNUNET_SCHEDULER_cancel (ph->task);
|
||||||
|
ph->task = NULL;
|
||||||
|
}
|
||||||
|
if (NULL != ph->job)
|
||||||
|
{
|
||||||
|
GNUNET_CURL_job_cancel (ph->job);
|
||||||
|
ph->job = NULL;
|
||||||
|
}
|
||||||
|
if (NULL != ph->response)
|
||||||
|
{
|
||||||
|
MHD_destroy_response (ph->response);
|
||||||
|
ph->response = NULL;
|
||||||
|
}
|
||||||
|
GNUNET_free (ph->provider_user_id);
|
||||||
|
if (NULL != ph->attributes)
|
||||||
|
json_decref (ph->attributes);
|
||||||
|
GNUNET_free (ph->post_body);
|
||||||
|
GNUNET_free (ph);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called to asynchronously return the final
|
* Function called to asynchronously return the final
|
||||||
* result to the callback.
|
* result to the callback.
|
||||||
@ -602,10 +639,8 @@ return_proof_response (void *cls)
|
|||||||
ph->attributes,
|
ph->attributes,
|
||||||
ph->http_status,
|
ph->http_status,
|
||||||
ph->response);
|
ph->response);
|
||||||
GNUNET_free (ph->provider_user_id);
|
ph->response = NULL; /*Ownership passed to 'ph->cb'!*/
|
||||||
if (NULL != ph->attributes)
|
oauth2_proof_cancel (ph);
|
||||||
json_decref (ph->attributes);
|
|
||||||
GNUNET_free (ph);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1101,7 +1136,6 @@ oauth2_proof (void *cls,
|
|||||||
1));
|
1));
|
||||||
{
|
{
|
||||||
char *client_id;
|
char *client_id;
|
||||||
char *redirect_uri;
|
|
||||||
char *client_secret;
|
char *client_secret;
|
||||||
char *authorization_code;
|
char *authorization_code;
|
||||||
char *redirect_uri_encoded;
|
char *redirect_uri_encoded;
|
||||||
@ -1109,6 +1143,9 @@ oauth2_proof (void *cls,
|
|||||||
|
|
||||||
hps = GNUNET_STRINGS_data_to_string_alloc (&ph->h_payto,
|
hps = GNUNET_STRINGS_data_to_string_alloc (&ph->h_payto,
|
||||||
sizeof (ph->h_payto));
|
sizeof (ph->h_payto));
|
||||||
|
{
|
||||||
|
char *redirect_uri;
|
||||||
|
|
||||||
GNUNET_asprintf (&redirect_uri,
|
GNUNET_asprintf (&redirect_uri,
|
||||||
"%skyc-proof/%s?state=%s",
|
"%skyc-proof/%s?state=%s",
|
||||||
ps->exchange_base_url,
|
ps->exchange_base_url,
|
||||||
@ -1116,6 +1153,7 @@ oauth2_proof (void *cls,
|
|||||||
hps);
|
hps);
|
||||||
redirect_uri_encoded = TALER_urlencode (redirect_uri);
|
redirect_uri_encoded = TALER_urlencode (redirect_uri);
|
||||||
GNUNET_free (redirect_uri);
|
GNUNET_free (redirect_uri);
|
||||||
|
}
|
||||||
GNUNET_assert (NULL != redirect_uri_encoded);
|
GNUNET_assert (NULL != redirect_uri_encoded);
|
||||||
client_id = curl_easy_escape (ph->eh,
|
client_id = curl_easy_escape (ph->eh,
|
||||||
pd->client_id,
|
pd->client_id,
|
||||||
@ -1164,34 +1202,6 @@ oauth2_proof (void *cls,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cancel KYC proof.
|
|
||||||
*
|
|
||||||
* @param[in] ph handle of operation to cancel
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
oauth2_proof_cancel (struct TALER_KYCLOGIC_ProofHandle *ph)
|
|
||||||
{
|
|
||||||
if (NULL != ph->task)
|
|
||||||
{
|
|
||||||
GNUNET_SCHEDULER_cancel (ph->task);
|
|
||||||
ph->task = NULL;
|
|
||||||
}
|
|
||||||
if (NULL != ph->job)
|
|
||||||
{
|
|
||||||
GNUNET_CURL_job_cancel (ph->job);
|
|
||||||
ph->job = NULL;
|
|
||||||
}
|
|
||||||
if (NULL != ph->response)
|
|
||||||
{
|
|
||||||
MHD_destroy_response (ph->response);
|
|
||||||
ph->response = NULL;
|
|
||||||
}
|
|
||||||
GNUNET_free (ph->post_body);
|
|
||||||
GNUNET_free (ph);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to asynchronously return the 404 not found
|
* Function to asynchronously return the 404 not found
|
||||||
* page for the webhook.
|
* page for the webhook.
|
||||||
|
@ -261,6 +261,7 @@ handle_wire_finished (void *cls,
|
|||||||
fbm = parse_fees (&master_pub,
|
fbm = parse_fees (&master_pub,
|
||||||
fees,
|
fees,
|
||||||
&wr.details.ok.fees_len);
|
&wr.details.ok.fees_len);
|
||||||
|
wr.details.ok.fees = fbm;
|
||||||
if (NULL == fbm)
|
if (NULL == fbm)
|
||||||
{
|
{
|
||||||
/* bogus reply */
|
/* bogus reply */
|
||||||
|
@ -310,6 +310,7 @@ cleanup (void *cls,
|
|||||||
(void) toe;
|
(void) toe;
|
||||||
if (NULL == rc)
|
if (NULL == rc)
|
||||||
return;
|
return;
|
||||||
|
MHD_destroy_post_processor (rc->pp);
|
||||||
GNUNET_free (rc->code);
|
GNUNET_free (rc->code);
|
||||||
GNUNET_free (rc->client_id);
|
GNUNET_free (rc->client_id);
|
||||||
GNUNET_free (rc->redirect_uri);
|
GNUNET_free (rc->redirect_uri);
|
||||||
|
Loading…
Reference in New Issue
Block a user