summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/auditor_api_curl_defaults.c17
-rw-r--r--src/lib/auditor_api_curl_defaults.h5
-rw-r--r--src/lib/auditor_api_deposit_confirmation.c29
-rw-r--r--src/lib/auditor_api_exchanges.c15
-rw-r--r--src/lib/auditor_api_handle.c31
-rw-r--r--src/lib/auditor_api_handle.h8
-rw-r--r--src/lib/exchange_api_curl_defaults.c6
-rw-r--r--src/lib/exchange_api_deposit.c12
-rw-r--r--src/lib/exchange_api_deposits_get.c7
-rw-r--r--src/lib/exchange_api_handle.c24
-rw-r--r--src/lib/exchange_api_link.c7
-rw-r--r--src/lib/exchange_api_melt.c12
-rw-r--r--src/lib/exchange_api_recoup.c12
-rw-r--r--src/lib/exchange_api_refreshes_reveal.c12
-rw-r--r--src/lib/exchange_api_refund.c12
-rw-r--r--src/lib/exchange_api_reserves_get.c7
-rw-r--r--src/lib/exchange_api_transfers_get.c7
-rw-r--r--src/lib/exchange_api_wire.c11
-rw-r--r--src/lib/exchange_api_withdraw.c12
19 files changed, 164 insertions, 82 deletions
diff --git a/src/lib/auditor_api_curl_defaults.c b/src/lib/auditor_api_curl_defaults.c
index 15c60862..d8c6f619 100644
--- a/src/lib/auditor_api_curl_defaults.c
+++ b/src/lib/auditor_api_curl_defaults.c
@@ -19,7 +19,6 @@
* @brief curl easy handle defaults
* @author Florian Dold
*/
-
#include "auditor_api_curl_defaults.h"
@@ -30,7 +29,7 @@
* @param url URL to query
*/
CURL *
-TAL_curl_easy_get (const char *url)
+TALER_AUDITOR_curl_easy_get_ (const char *url)
{
CURL *eh;
struct GNUNET_AsyncScopeSave scope;
@@ -38,15 +37,25 @@ TAL_curl_easy_get (const char *url)
GNUNET_async_scope_get (&scope);
eh = curl_easy_init ();
-
+ if (NULL == eh)
+ return NULL;
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,
CURLOPT_URL,
url));
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,
+ CURLOPT_FOLLOWLOCATION,
+ 1L));
+ /* limit MAXREDIRS to 5 as a simple security measure against
+ a potential infinite loop caused by a malicious target */
+ GNUNET_assert (CURLE_OK ==
+ curl_easy_setopt (eh,
+ CURLOPT_MAXREDIRS,
+ 5L));
+ GNUNET_assert (CURLE_OK ==
+ curl_easy_setopt (eh,
CURLOPT_TCP_FASTOPEN,
1L));
-
return eh;
}
diff --git a/src/lib/auditor_api_curl_defaults.h b/src/lib/auditor_api_curl_defaults.h
index e16f9004..99e1e07e 100644
--- a/src/lib/auditor_api_curl_defaults.h
+++ b/src/lib/auditor_api_curl_defaults.h
@@ -14,17 +14,14 @@
TALER; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>
*/
-
/**
* @file lib/auditor_api_curl_defaults.h
* @brief curl easy handle defaults
* @author Florian Dold
*/
-
#ifndef _TALER_CURL_DEFAULTS_H
#define _TALER_CURL_DEFAULTS_H
-
#include "platform.h"
#include <gnunet/gnunet_curl_lib.h>
@@ -36,6 +33,6 @@
* @param url URL to query
*/
CURL *
-TAL_curl_easy_get (const char *url);
+TALER_AUDITOR_curl_easy_get_ (const char *url);
#endif /* _TALER_CURL_DEFAULTS_H */
diff --git a/src/lib/auditor_api_deposit_confirmation.c b/src/lib/auditor_api_deposit_confirmation.c
index 54a99c71..ddaf9b7c 100644
--- a/src/lib/auditor_api_deposit_confirmation.c
+++ b/src/lib/auditor_api_deposit_confirmation.c
@@ -290,7 +290,7 @@ TALER_AUDITOR_deposit_confirmation (struct TALER_AUDITOR_Handle *auditor,
(void) GNUNET_TIME_round_abs (&ep_expire);
(void) GNUNET_TIME_round_abs (&ep_end);
GNUNET_assert (GNUNET_YES ==
- MAH_handle_is_ready (auditor));
+ TALER_AUDITOR_handle_is_ready_ (auditor));
if (GNUNET_OK !=
verify_signatures (h_wire,
h_contract_terms,
@@ -346,20 +346,23 @@ TALER_AUDITOR_deposit_confirmation (struct TALER_AUDITOR_Handle *auditor,
dh->auditor = auditor;
dh->cb = cb;
dh->cb_cls = cb_cls;
- dh->url = MAH_path_to_url (auditor, "/deposit-confirmation");
+ dh->url = TALER_AUDITOR_path_to_url_ (auditor,
+ "/deposit-confirmation");
+ eh = TALER_AUDITOR_curl_easy_get_ (dh->url);
- eh = TAL_curl_easy_get (dh->url);
- GNUNET_assert (CURLE_OK ==
- curl_easy_setopt (eh,
- CURLOPT_CUSTOMREQUEST,
- "PUT"));
- if (GNUNET_OK !=
- TALER_curl_easy_post (&dh->ctx,
- eh,
- deposit_confirmation_obj))
+ if ( (NULL == eh) ||
+ (CURLE_OK !=
+ curl_easy_setopt (eh,
+ CURLOPT_CUSTOMREQUEST,
+ "PUT")) ||
+ (GNUNET_OK !=
+ TALER_curl_easy_post (&dh->ctx,
+ eh,
+ deposit_confirmation_obj)) )
{
GNUNET_break (0);
- curl_easy_cleanup (eh);
+ if (NULL != eh)
+ curl_easy_cleanup (eh);
json_decref (deposit_confirmation_obj);
GNUNET_free (dh->url);
GNUNET_free (dh);
@@ -369,7 +372,7 @@ TALER_AUDITOR_deposit_confirmation (struct TALER_AUDITOR_Handle *auditor,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"URL for deposit-confirmation: `%s'\n",
dh->url);
- ctx = MAH_handle_to_context (auditor);
+ ctx = TALER_AUDITOR_handle_to_context_ (auditor);
dh->job = GNUNET_CURL_job_add2 (ctx,
eh,
dh->ctx.headers,
diff --git a/src/lib/auditor_api_exchanges.c b/src/lib/auditor_api_exchanges.c
index 09bdcc57..329b0106 100644
--- a/src/lib/auditor_api_exchanges.c
+++ b/src/lib/auditor_api_exchanges.c
@@ -201,19 +201,26 @@ TALER_AUDITOR_list_exchanges (struct TALER_AUDITOR_Handle *auditor,
CURL *eh;
GNUNET_assert (GNUNET_YES ==
- MAH_handle_is_ready (auditor));
+ TALER_AUDITOR_handle_is_ready_ (auditor));
leh = GNUNET_new (struct TALER_AUDITOR_ListExchangesHandle);
leh->auditor = auditor;
leh->cb = cb;
leh->cb_cls = cb_cls;
- leh->url = MAH_path_to_url (auditor, "/exchanges");
+ leh->url = TALER_AUDITOR_path_to_url_ (auditor, "/exchanges");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"URL for list-exchanges: `%s'\n",
leh->url);
- eh = TAL_curl_easy_get (leh->url);
- ctx = MAH_handle_to_context (auditor);
+ eh = TALER_AUDITOR_curl_easy_get_ (leh->url);
+ if (NULL == eh)
+ {
+ GNUNET_break (0);
+ GNUNET_free (leh->url);
+ GNUNET_free (leh);
+ return NULL;
+ }
+ ctx = TALER_AUDITOR_handle_to_context_ (auditor);
leh->job = GNUNET_CURL_job_add (ctx,
eh,
GNUNET_NO,
diff --git a/src/lib/auditor_api_handle.c b/src/lib/auditor_api_handle.c
index 3d953dc5..c0555598 100644
--- a/src/lib/auditor_api_handle.c
+++ b/src/lib/auditor_api_handle.c
@@ -367,7 +367,7 @@ version_completed_cb (void *cls,
* @return ctx context to execute jobs in
*/
struct GNUNET_CURL_Context *
-MAH_handle_to_context (struct TALER_AUDITOR_Handle *h)
+TALER_AUDITOR_handle_to_context_ (struct TALER_AUDITOR_Handle *h)
{
return h->ctx;
}
@@ -380,7 +380,7 @@ MAH_handle_to_context (struct TALER_AUDITOR_Handle *h)
* @return #GNUNET_YES if we are ready, #GNUNET_NO if not
*/
int
-MAH_handle_is_ready (struct TALER_AUDITOR_Handle *h)
+TALER_AUDITOR_handle_is_ready_ (struct TALER_AUDITOR_Handle *h)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Checking if auditor %p (%s) is now ready: %s\n",
@@ -399,8 +399,8 @@ MAH_handle_is_ready (struct TALER_AUDITOR_Handle *h)
* @return the full URL to use with cURL
*/
char *
-MAH_path_to_url (struct TALER_AUDITOR_Handle *h,
- const char *path)
+TALER_AUDITOR_path_to_url_ (struct TALER_AUDITOR_Handle *h,
+ const char *path)
{
char *ret;
GNUNET_assert ('/' == path[0]);
@@ -473,16 +473,25 @@ request_version (void *cls)
GNUNET_assert (NULL == auditor->vr);
vr = GNUNET_new (struct VersionRequest);
vr->auditor = auditor;
- vr->url = MAH_path_to_url (auditor,
- "/version");
+ vr->url = TALER_AUDITOR_path_to_url_ (auditor,
+ "/version");
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Requesting auditor version with URL `%s'.\n",
vr->url);
- eh = TAL_curl_easy_get (vr->url);
- GNUNET_assert (CURLE_OK ==
- curl_easy_setopt (eh,
- CURLOPT_TIMEOUT,
- (long) 300));
+ eh = TALER_AUDITOR_curl_easy_get_ (vr->url);
+ if (NULL == eh)
+ {
+ GNUNET_break (0);
+ auditor->retry_delay = EXCHANGE_LIB_BACKOFF (auditor->retry_delay);
+ auditor->retry_task = GNUNET_SCHEDULER_add_delayed (auditor->retry_delay,
+ &request_version,
+ auditor);
+ return;
+ }
+ GNUNET_break (CURLE_OK ==
+ curl_easy_setopt (eh,
+ CURLOPT_TIMEOUT,
+ (long) 300));
vr->job = GNUNET_CURL_job_add (auditor->ctx,
eh,
GNUNET_NO,
diff --git a/src/lib/auditor_api_handle.h b/src/lib/auditor_api_handle.h
index 013fe9b0..7ff5bfcd 100644
--- a/src/lib/auditor_api_handle.h
+++ b/src/lib/auditor_api_handle.h
@@ -31,7 +31,7 @@
* @return ctx context to execute jobs in
*/
struct GNUNET_CURL_Context *
-MAH_handle_to_context (struct TALER_AUDITOR_Handle *h);
+TALER_AUDITOR_handle_to_context_ (struct TALER_AUDITOR_Handle *h);
/**
@@ -41,7 +41,7 @@ MAH_handle_to_context (struct TALER_AUDITOR_Handle *h);
* @return #GNUNET_YES if we are ready, #GNUNET_NO if not
*/
int
-MAH_handle_is_ready (struct TALER_AUDITOR_Handle *h);
+TALER_AUDITOR_handle_is_ready_ (struct TALER_AUDITOR_Handle *h);
/**
@@ -52,8 +52,8 @@ MAH_handle_is_ready (struct TALER_AUDITOR_Handle *h);
* @return the full URL to use with cURL
*/
char *
-MAH_path_to_url (struct TALER_AUDITOR_Handle *h,
- const char *path);
+TALER_AUDITOR_path_to_url_ (struct TALER_AUDITOR_Handle *h,
+ const char *path);
/* end of auditor_api_handle.h */
diff --git a/src/lib/exchange_api_curl_defaults.c b/src/lib/exchange_api_curl_defaults.c
index 26c1ac7d..82d3ace1 100644
--- a/src/lib/exchange_api_curl_defaults.c
+++ b/src/lib/exchange_api_curl_defaults.c
@@ -24,8 +24,8 @@
/**
- * Get a curl handle with the right defaults
- * for the exchange lib. In the future, we might manage a pool of connections here.
+ * Get a curl handle with the right defaults for the exchange lib. In the
+ * future, we might manage a pool of connections here.
*
* @param url URL to query
*/
@@ -35,6 +35,8 @@ TALER_EXCHANGE_curl_easy_get_ (const char *url)
CURL *eh;
eh = curl_easy_init ();
+ if (NULL == eh)
+ return NULL;
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,
CURLOPT_URL,
diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c
index 24b9f6fe..928a378b 100644
--- a/src/lib/exchange_api_deposit.c
+++ b/src/lib/exchange_api_deposit.c
@@ -627,13 +627,15 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
not copy the pointer */
eh = TALER_EXCHANGE_curl_easy_get_ (dh->url);
- if (GNUNET_OK !=
- TALER_curl_easy_post (&dh->ctx,
- eh,
- deposit_obj))
+ if ( (NULL == eh) ||
+ (GNUNET_OK !=
+ TALER_curl_easy_post (&dh->ctx,
+ eh,
+ deposit_obj)) )
{
GNUNET_break (0);
- curl_easy_cleanup (eh);
+ if (NULL != eh)
+ curl_easy_cleanup (eh);
json_decref (deposit_obj);
GNUNET_free (dh->url);
GNUNET_free (dh);
diff --git a/src/lib/exchange_api_deposits_get.c b/src/lib/exchange_api_deposits_get.c
index 40d86401..bfacd178 100644
--- a/src/lib/exchange_api_deposits_get.c
+++ b/src/lib/exchange_api_deposits_get.c
@@ -367,6 +367,13 @@ TALER_EXCHANGE_deposits_get (struct TALER_EXCHANGE_Handle *exchange,
dwh->depconf.coin_pub = *coin_pub;
eh = TALER_EXCHANGE_curl_easy_get_ (dwh->url);
+ if (NULL == eh)
+ {
+ GNUNET_break (0);
+ GNUNET_free (dwh->url);
+ GNUNET_free (dwh);
+ return NULL;
+ }
ctx = TEAH_handle_to_context (exchange);
dwh->job = GNUNET_CURL_job_add (ctx,
eh,
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index 0d3118bf..ce6ef2e2 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -1954,14 +1954,22 @@ request_keys (void *cls)
"Requesting keys with URL `%s'.\n",
kr->url);
eh = TALER_EXCHANGE_curl_easy_get_ (kr->url);
- GNUNET_assert (CURLE_OK ==
- curl_easy_setopt (eh,
- CURLOPT_VERBOSE,
- 0));
- GNUNET_assert (CURLE_OK ==
- curl_easy_setopt (eh,
- CURLOPT_TIMEOUT,
- (long) 300));
+ if (NULL == eh)
+ {
+ exchange->retry_delay = EXCHANGE_LIB_BACKOFF (exchange->retry_delay);
+ exchange->retry_task = GNUNET_SCHEDULER_add_delayed (exchange->retry_delay,
+ &request_keys,
+ exchange);
+ return;
+ }
+ GNUNET_break (CURLE_OK ==
+ curl_easy_setopt (eh,
+ CURLOPT_VERBOSE,
+ 0));
+ GNUNET_break (CURLE_OK ==
+ curl_easy_setopt (eh,
+ CURLOPT_TIMEOUT,
+ (long) 300));
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,
CURLOPT_HEADERFUNCTION,
diff --git a/src/lib/exchange_api_link.c b/src/lib/exchange_api_link.c
index e659a41c..aa508ecf 100644
--- a/src/lib/exchange_api_link.c
+++ b/src/lib/exchange_api_link.c
@@ -456,6 +456,13 @@ TALER_EXCHANGE_link (struct TALER_EXCHANGE_Handle *exchange,
lh->url = TEAH_path_to_url (exchange,
arg_str);
eh = TALER_EXCHANGE_curl_easy_get_ (lh->url);
+ if (NULL == eh)
+ {
+ GNUNET_break (0);
+ GNUNET_free (lh->url);
+ GNUNET_free (lh);
+ return NULL;
+ }
ctx = TEAH_handle_to_context (exchange);
lh->job = GNUNET_CURL_job_add (ctx,
eh,
diff --git a/src/lib/exchange_api_melt.c b/src/lib/exchange_api_melt.c
index 5a3abba8..39d9d4e0 100644
--- a/src/lib/exchange_api_melt.c
+++ b/src/lib/exchange_api_melt.c
@@ -457,13 +457,15 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange,
mh->url = TEAH_path_to_url (exchange,
arg_str);
eh = TALER_EXCHANGE_curl_easy_get_ (mh->url);
- if (GNUNET_OK !=
- TALER_curl_easy_post (&mh->ctx,
- eh,
- melt_obj))
+ if ( (NULL == eh) ||
+ (GNUNET_OK !=
+ TALER_curl_easy_post (&mh->ctx,
+ eh,
+ melt_obj)) )
{
GNUNET_break (0);
- curl_easy_cleanup (eh);
+ if (NULL != eh)
+ curl_easy_cleanup (eh);
json_decref (melt_obj);
GNUNET_free (mh->url);
GNUNET_free (mh);
diff --git a/src/lib/exchange_api_recoup.c b/src/lib/exchange_api_recoup.c
index 013d480b..5a275935 100644
--- a/src/lib/exchange_api_recoup.c
+++ b/src/lib/exchange_api_recoup.c
@@ -390,13 +390,15 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
arg_str);
ph->was_refreshed = was_refreshed;
eh = TALER_EXCHANGE_curl_easy_get_ (ph->url);
- if (GNUNET_OK !=
- TALER_curl_easy_post (&ph->ctx,
- eh,
- recoup_obj))
+ if ( (NULL == eh) ||
+ (GNUNET_OK !=
+ TALER_curl_easy_post (&ph->ctx,
+ eh,
+ recoup_obj)) )
{
GNUNET_break (0);
- curl_easy_cleanup (eh);
+ if (NULL != eh)
+ curl_easy_cleanup (eh);
json_decref (recoup_obj);
GNUNET_free (ph->url);
GNUNET_free (ph);
diff --git a/src/lib/exchange_api_refreshes_reveal.c b/src/lib/exchange_api_refreshes_reveal.c
index 20e19673..25b937b9 100644
--- a/src/lib/exchange_api_refreshes_reveal.c
+++ b/src/lib/exchange_api_refreshes_reveal.c
@@ -462,13 +462,15 @@ TALER_EXCHANGE_refreshes_reveal (struct TALER_EXCHANGE_Handle *exchange,
arg_str);
eh = TALER_EXCHANGE_curl_easy_get_ (rrh->url);
- if (GNUNET_OK !=
- TALER_curl_easy_post (&rrh->ctx,
- eh,
- reveal_obj))
+ if ( (NULL == eh) ||
+ (GNUNET_OK !=
+ TALER_curl_easy_post (&rrh->ctx,
+ eh,
+ reveal_obj)) )
{
GNUNET_break (0);
- curl_easy_cleanup (eh);
+ if (NULL != eh)
+ curl_easy_cleanup (eh);
json_decref (reveal_obj);
GNUNET_free (rrh->url);
GNUNET_free (rrh);
diff --git a/src/lib/exchange_api_refund.c b/src/lib/exchange_api_refund.c
index 8c50c80b..d14481e7 100644
--- a/src/lib/exchange_api_refund.c
+++ b/src/lib/exchange_api_refund.c
@@ -388,13 +388,15 @@ TALER_EXCHANGE_refund2 (struct TALER_EXCHANGE_Handle *exchange,
refund_fee);
eh = TALER_EXCHANGE_curl_easy_get_ (rh->url);
- if (GNUNET_OK !=
- TALER_curl_easy_post (&rh->ctx,
- eh,
- refund_obj))
+ if ( (NULL == eh) ||
+ (GNUNET_OK !=
+ TALER_curl_easy_post (&rh->ctx,
+ eh,
+ refund_obj)) )
{
GNUNET_break (0);
- curl_easy_cleanup (eh);
+ if (NULL != eh)
+ curl_easy_cleanup (eh);
json_decref (refund_obj);
GNUNET_free (rh->url);
GNUNET_free (rh);
diff --git a/src/lib/exchange_api_reserves_get.c b/src/lib/exchange_api_reserves_get.c
index 37adace5..39932d65 100644
--- a/src/lib/exchange_api_reserves_get.c
+++ b/src/lib/exchange_api_reserves_get.c
@@ -275,6 +275,13 @@ TALER_EXCHANGE_reserves_get (struct TALER_EXCHANGE_Handle *exchange,
rgh->url = TEAH_path_to_url (exchange,
arg_str);
eh = TALER_EXCHANGE_curl_easy_get_ (rgh->url);
+ if (NULL == eh)
+ {
+ GNUNET_break (0);
+ GNUNET_free (rgh->url);
+ GNUNET_free (rgh);
+ return NULL;
+ }
ctx = TEAH_handle_to_context (exchange);
rgh->job = GNUNET_CURL_job_add (ctx,
eh,
diff --git a/src/lib/exchange_api_transfers_get.c b/src/lib/exchange_api_transfers_get.c
index 25a1fea8..589a809e 100644
--- a/src/lib/exchange_api_transfers_get.c
+++ b/src/lib/exchange_api_transfers_get.c
@@ -367,6 +367,13 @@ TALER_EXCHANGE_transfers_get (struct TALER_EXCHANGE_Handle *exchange,
wdh->url = TEAH_path_to_url (wdh->exchange,
arg_str);
eh = TALER_EXCHANGE_curl_easy_get_ (wdh->url);
+ if (NULL == eh)
+ {
+ GNUNET_break (0);
+ GNUNET_free (wdh->url);
+ GNUNET_free (wdh);
+ return NULL;
+ }
ctx = TEAH_handle_to_context (exchange);
wdh->job = GNUNET_CURL_job_add (ctx,
eh,
diff --git a/src/lib/exchange_api_wire.c b/src/lib/exchange_api_wire.c
index 81b9f430..1ac44c70 100644
--- a/src/lib/exchange_api_wire.c
+++ b/src/lib/exchange_api_wire.c
@@ -405,9 +405,16 @@ TALER_EXCHANGE_wire (struct TALER_EXCHANGE_Handle *exchange,
wh->exchange = exchange;
wh->cb = wire_cb;
wh->cb_cls = wire_cb_cls;
- wh->url = TEAH_path_to_url (exchange, "/wire");
-
+ wh->url = TEAH_path_to_url (exchange,
+ "/wire");
eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
+ if (NULL == eh)
+ {
+ GNUNET_break (0);
+ GNUNET_free (wh->url);
+ GNUNET_free (wh);
+ return NULL;
+ }
ctx = TEAH_handle_to_context (exchange);
wh->job = GNUNET_CURL_job_add (ctx,
eh,
diff --git a/src/lib/exchange_api_withdraw.c b/src/lib/exchange_api_withdraw.c
index 47c05082..85f64523 100644
--- a/src/lib/exchange_api_withdraw.c
+++ b/src/lib/exchange_api_withdraw.c
@@ -427,13 +427,15 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange,
wh->url = TEAH_path_to_url (exchange,
arg_str);
eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
- if (GNUNET_OK !=
- TALER_curl_easy_post (&wh->ctx,
- eh,
- withdraw_obj))
+ if ( (NULL == eh) ||
+ (GNUNET_OK !=
+ TALER_curl_easy_post (&wh->ctx,
+ eh,
+ withdraw_obj)) )
{
GNUNET_break (0);
- curl_easy_cleanup (eh);
+ if (NULL != eh)
+ curl_easy_cleanup (eh);
json_decref (withdraw_obj);
GNUNET_free (wh->url);
GNUNET_CRYPTO_rsa_public_key_free (wh->pk.key.rsa_public_key);