summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/merchant_api_check_payment.c15
-rw-r--r--src/lib/merchant_api_history.c10
-rw-r--r--src/lib/merchant_api_pay.c13
-rw-r--r--src/lib/merchant_api_poll_payment.c7
-rw-r--r--src/lib/merchant_api_proposal.c4
-rw-r--r--src/lib/merchant_api_refund.c11
-rw-r--r--src/lib/merchant_api_tip_authorize.c9
-rw-r--r--src/lib/merchant_api_tip_pickup.c10
-rw-r--r--src/lib/merchant_api_tip_query.c10
-rw-r--r--src/lib/merchant_api_track_transaction.c13
-rw-r--r--src/lib/merchant_api_track_transfer.c7
11 files changed, 97 insertions, 12 deletions
diff --git a/src/lib/merchant_api_check_payment.c b/src/lib/merchant_api_check_payment.c
index 4a9e70e1..c4c07ae9 100644
--- a/src/lib/merchant_api_check_payment.c
+++ b/src/lib/merchant_api_check_payment.c
@@ -225,6 +225,13 @@ TALER_MERCHANT_check_payment (struct GNUNET_CURL_Context *ctx,
(0 != ts) ? "timeout" : NULL,
timeout_s,
NULL);
+ if (NULL == cpo->url)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not construct request URL.\n");
+ GNUNET_free (cpo);
+ return NULL;
+ }
GNUNET_free (timeout_s);
eh = curl_easy_init ();
if (CURLE_OK != curl_easy_setopt (eh,
@@ -232,6 +239,9 @@ TALER_MERCHANT_check_payment (struct GNUNET_CURL_Context *ctx,
cpo->url))
{
GNUNET_break (0);
+ curl_easy_cleanup (eh);
+ GNUNET_free (cpo->url);
+ GNUNET_free (cpo);
return NULL;
}
if (CURLE_OK != curl_easy_setopt (eh,
@@ -239,6 +249,9 @@ TALER_MERCHANT_check_payment (struct GNUNET_CURL_Context *ctx,
tlong))
{
GNUNET_break (0);
+ curl_easy_cleanup (eh);
+ GNUNET_free (cpo->url);
+ GNUNET_free (cpo);
return NULL;
}
@@ -252,6 +265,8 @@ TALER_MERCHANT_check_payment (struct GNUNET_CURL_Context *ctx,
cpo)))
{
GNUNET_break (0);
+ GNUNET_free (cpo->url);
+ GNUNET_free (cpo);
return NULL;
}
return cpo;
diff --git a/src/lib/merchant_api_history.c b/src/lib/merchant_api_history.c
index 726204c3..c00cfa83 100644
--- a/src/lib/merchant_api_history.c
+++ b/src/lib/merchant_api_history.c
@@ -178,12 +178,18 @@ TALER_MERCHANT_history2 (struct GNUNET_CURL_Context *ctx,
CURL *eh;
char *base;
+ base = TALER_url_join (backend_url, "history", NULL);
+ if (NULL == base)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not construct request URL.\n");
+ return NULL;
+ }
ho = GNUNET_new (struct TALER_MERCHANT_HistoryOperation);
ho->ctx = ctx;
ho->cb = history_cb;
ho->cb_cls = history_cb_cls;
seconds = date.abs_value_us / 1000LL / 1000LL;
- base = TALER_url_join (backend_url, "history", NULL);
if (GNUNET_YES == use_default_start)
GNUNET_asprintf (&ho->url,
@@ -198,8 +204,6 @@ TALER_MERCHANT_history2 (struct GNUNET_CURL_Context *ctx,
seconds,
delta,
start);
-
-
GNUNET_free (base);
eh = curl_easy_init ();
if (CURLE_OK != curl_easy_setopt (eh,
diff --git a/src/lib/merchant_api_pay.c b/src/lib/merchant_api_pay.c
index 174b0c6d..cf25337e 100644
--- a/src/lib/merchant_api_pay.c
+++ b/src/lib/merchant_api_pay.c
@@ -522,7 +522,7 @@ request_pay_generic
&pc->amount_without_fee))
{
/* Integer underflow, fee larger than total amount?
- This should not happen (client violated API!) */
+ This should not happen (client violated API!) */
GNUNET_break (0);
json_decref (j_coins);
return NULL;
@@ -599,6 +599,14 @@ request_pay_generic
ph->pay_cb = pay_cb;
ph->pay_cb_cls = pay_cb_cls;
ph->url = TALER_url_join (merchant_url, "pay", NULL);
+ if (NULL == ph->url)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not construct request URL.\n");
+ json_decref (pay_obj);
+ GNUNET_free (ph);
+ return NULL;
+ }
ph->num_coins = num_coins;
ph->coins = GNUNET_new_array (num_coins,
struct TALER_MERCHANT_PaidCoin);
@@ -613,6 +621,7 @@ request_pay_generic
pay_obj))
{
GNUNET_break (0);
+ json_decref (pay_obj);
GNUNET_free (ph);
return NULL;
}
@@ -724,7 +733,7 @@ prepare_pay_generic (struct GNUNET_CURL_Context *ctx,
&coin->amount_without_fee))
{
/* Integer underflow, fee larger than total amount?
- This should not happen (client violated API!) */
+ This should not happen (client violated API!) */
GNUNET_break (0);
return NULL;
}
diff --git a/src/lib/merchant_api_poll_payment.c b/src/lib/merchant_api_poll_payment.c
index af44d2b6..4c819a22 100644
--- a/src/lib/merchant_api_poll_payment.c
+++ b/src/lib/merchant_api_poll_payment.c
@@ -250,6 +250,13 @@ TALER_MERCHANT_poll_payment (struct GNUNET_CURL_Context *ctx,
NULL);
GNUNET_free (h_contract_s);
GNUNET_free (timeout_s);
+ if (NULL == cpo->url)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not construct request URL.\n");
+ GNUNET_free (cpo);
+ return NULL;
+ }
eh = curl_easy_init ();
if (CURLE_OK != curl_easy_setopt (eh,
CURLOPT_URL,
diff --git a/src/lib/merchant_api_proposal.c b/src/lib/merchant_api_proposal.c
index 920f08e9..72a603a3 100644
--- a/src/lib/merchant_api_proposal.c
+++ b/src/lib/merchant_api_proposal.c
@@ -238,6 +238,7 @@ TALER_MERCHANT_order_put
req))
{
GNUNET_break (0);
+ json_decref (req);
GNUNET_free (po);
return NULL;
}
@@ -397,8 +398,7 @@ TALER_MERCHANT_proposal_lookup (struct GNUNET_CURL_Context *ctx,
if (NULL == plo->url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Could not construct request URL. Is `%s' valid?\n",
- backend_url);
+ "Could not construct request URL.\n");
GNUNET_free (plo);
return NULL;
}
diff --git a/src/lib/merchant_api_refund.c b/src/lib/merchant_api_refund.c
index 19b39e6b..3c079ce4 100644
--- a/src/lib/merchant_api_refund.c
+++ b/src/lib/merchant_api_refund.c
@@ -212,6 +212,14 @@ TALER_MERCHANT_refund_increase (struct GNUNET_CURL_Context *ctx,
rio->cb = cb;
rio->cb_cls = cb_cls;
rio->url = TALER_url_join (backend_url, "refund", NULL);
+ if (NULL == rio->url)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not construct request URL.\n");
+ GNUNET_free (rio);
+ return NULL;
+ }
+
req = json_pack ("{s:o, s:s, s:s}",
"refund", TALER_JSON_from_amount (refund),
"order_id", order_id,
@@ -223,10 +231,11 @@ TALER_MERCHANT_refund_increase (struct GNUNET_CURL_Context *ctx,
req))
{
GNUNET_break (0);
+ json_decref (req);
+ GNUNET_free (rio->url);
GNUNET_free (rio);
return NULL;
}
-
json_decref (req);
GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
diff --git a/src/lib/merchant_api_tip_authorize.c b/src/lib/merchant_api_tip_authorize.c
index 22fd3291..e1b21da0 100644
--- a/src/lib/merchant_api_tip_authorize.c
+++ b/src/lib/merchant_api_tip_authorize.c
@@ -203,6 +203,13 @@ TALER_MERCHANT_tip_authorize (struct GNUNET_CURL_Context *ctx,
tao->cb = authorize_cb;
tao->cb_cls = authorize_cb_cls;
tao->url = TALER_url_join (backend_url, "tip-authorize", NULL);
+ if (NULL == tao->url)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not construct request URL.\n");
+ GNUNET_free (tao);
+ return NULL;
+ }
te_obj = json_pack ("{"
" s:o," /* amount */
" s:s," /* justification */
@@ -227,6 +234,8 @@ TALER_MERCHANT_tip_authorize (struct GNUNET_CURL_Context *ctx,
te_obj))
{
GNUNET_break (0);
+ json_decref (te_obj);
+ GNUNET_free (tao->url);
GNUNET_free (tao);
return NULL;
}
diff --git a/src/lib/merchant_api_tip_pickup.c b/src/lib/merchant_api_tip_pickup.c
index 12b08f4f..9473a8a4 100644
--- a/src/lib/merchant_api_tip_pickup.c
+++ b/src/lib/merchant_api_tip_pickup.c
@@ -290,16 +290,24 @@ TALER_MERCHANT_tip_pickup (struct GNUNET_CURL_Context *ctx,
tpo->url = TALER_url_join (backend_url,
"tip-pickup",
NULL);
+ if (NULL == tpo->url)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not construct request URL.\n");
+ json_decref (tp_obj);
+ GNUNET_free (tpo);
+ return NULL;
+ }
eh = curl_easy_init ();
if (GNUNET_OK != TALER_curl_easy_post (&tpo->post_ctx,
eh,
tp_obj))
{
GNUNET_break (0);
+ json_decref (tp_obj);
GNUNET_free (tpo);
return NULL;
}
-
json_decref (tp_obj);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/lib/merchant_api_tip_query.c b/src/lib/merchant_api_tip_query.c
index 8e3600d5..d2a98a99 100644
--- a/src/lib/merchant_api_tip_query.c
+++ b/src/lib/merchant_api_tip_query.c
@@ -202,8 +202,16 @@ TALER_MERCHANT_tip_query (struct GNUNET_CURL_Context *ctx,
tqo->ctx = ctx;
tqo->cb = query_cb;
tqo->cb_cls = query_cb_cls;
- tqo->url = TALER_url_join (backend_url, "tip-query",
+ tqo->url = TALER_url_join (backend_url,
+ "tip-query",
NULL);
+ if (NULL == tqo->url)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not construct request URL.\n");
+ GNUNET_free (tqo);
+ return NULL;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Requesting URL '%s'\n",
diff --git a/src/lib/merchant_api_track_transaction.c b/src/lib/merchant_api_track_transaction.c
index aa72962c..6b1144d1 100644
--- a/src/lib/merchant_api_track_transaction.c
+++ b/src/lib/merchant_api_track_transaction.c
@@ -154,8 +154,17 @@ TALER_MERCHANT_track_transaction (struct GNUNET_CURL_Context *ctx,
tdo->ctx = ctx;
tdo->cb = track_transaction_cb;
tdo->cb_cls = track_transaction_cb_cls;
- tdo->url = TALER_url_join (backend_url, "track/transaction",
- "order_id", order_id, NULL);
+ tdo->url = TALER_url_join (backend_url,
+ "track/transaction",
+ "order_id", order_id,
+ NULL);
+ if (NULL == tdo->url)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not construct request URL.\n");
+ GNUNET_free (tdo);
+ return NULL;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
tdo->url);
diff --git a/src/lib/merchant_api_track_transfer.c b/src/lib/merchant_api_track_transfer.c
index 791d5b8c..4122b0b3 100644
--- a/src/lib/merchant_api_track_transfer.c
+++ b/src/lib/merchant_api_track_transfer.c
@@ -254,6 +254,13 @@ TALER_MERCHANT_track_transfer (struct GNUNET_CURL_Context *ctx,
"wire_method", wire_method,
NULL);
GNUNET_free (wtid_str);
+ if (NULL == tdo->url)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not construct request URL.\n");
+ GNUNET_free (tdo);
+ return NULL;
+ }
eh = curl_easy_init ();
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,