diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-09-15 10:54:10 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-09-15 10:54:10 +0200 |
commit | 8843d60e683157f40e1908a4dc57b82f6f6bb6ee (patch) | |
tree | 177c6bea47fb7580251aa9d3242f971d26970efe /src/wire-plugins/plugin_wire_taler-bank.c | |
parent | fc19601efc46cf31bf81c0d5980d6802148f5964 (diff) | |
download | exchange-8843d60e683157f40e1908a4dc57b82f6f6bb6ee.tar.xz |
fix memory leak and style issues
Diffstat (limited to 'src/wire-plugins/plugin_wire_taler-bank.c')
-rw-r--r-- | src/wire-plugins/plugin_wire_taler-bank.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/wire-plugins/plugin_wire_taler-bank.c b/src/wire-plugins/plugin_wire_taler-bank.c index 97b1e6c84..e1db643d3 100644 --- a/src/wire-plugins/plugin_wire_taler-bank.c +++ b/src/wire-plugins/plugin_wire_taler-bank.c @@ -765,7 +765,8 @@ struct TALER_WIRE_HistoryHandle { /** - * Function to call with results. + * Function to call with results, can become NULL if the + * application cancels the iteration. */ TALER_WIRE_HistoryResultCallback hres_cb; @@ -797,6 +798,7 @@ static void taler_bank_get_history_cancel (void *cls, struct TALER_WIRE_HistoryHandle *whh) { + (void) cls; if (NULL != whh->hh) { TALER_BANK_history_cancel (whh->hh); @@ -893,7 +895,11 @@ bhist_cb (void *cls, GNUNET_break (NULL != whh->hh); /* Once we get the sentinel element, the handle becomes invalid. */ if (TALER_BANK_DIRECTION_NONE == dir) + { whh->hh = NULL; + taler_bank_get_history_cancel (NULL, + whh); + } return; } case MHD_HTTP_NO_CONTENT: @@ -904,6 +910,9 @@ bhist_cb (void *cls, NULL, 0, NULL); + whh->hh = NULL; + taler_bank_get_history_cancel (NULL, + whh); break; default: GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -917,6 +926,9 @@ bhist_cb (void *cls, NULL, 0, NULL); + whh->hh = NULL; + taler_bank_get_history_cancel (NULL, + whh); break; } whh->hh = NULL; @@ -962,6 +974,7 @@ taler_bank_get_history (void *cls, uint64_t start_row; struct TALER_Account account; + GNUNET_assert (NULL != hres_cb); if (0 == num_results) { GNUNET_break (0); @@ -1019,13 +1032,12 @@ taler_bank_get_history (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not parse the auth values from '%s'\n", account_section); + TALER_WIRE_account_free (&account); GNUNET_free (whh); return NULL; } - whh->hres_cb = hres_cb; whh->hres_cb_cls = hres_cb_cls; - whh->hh = TALER_BANK_history (tc->ctx, account.details.x_taler_bank.bank_base_url, &whh->auth, @@ -1040,16 +1052,16 @@ taler_bank_get_history (void *cls, if (NULL == whh->hh) { GNUNET_break (0); - taler_bank_get_history_cancel (NULL, + taler_bank_get_history_cancel (tc, whh); TALER_WIRE_account_free (&account); return NULL; } TALER_WIRE_account_free (&account); - GNUNET_assert (NULL != whh); return whh; } + /** * Context for a rejection operation. */ |