fix memory leak if traits are requested multiple times per withdraw

This commit is contained in:
Christian Grothoff 2019-02-17 00:18:04 +01:00
parent 3ff5bad33e
commit 70e7bc1184
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -262,7 +262,7 @@ withdraw_run (void *cls,
} }
TALER_planchet_setup_random (&ws->ps); TALER_planchet_setup_random (&ws->ps);
ws->is = is; ws->is = is;
ws->pk = TALER_TESTING_find_pk ws->pk = TALER_TESTING_find_pk
(TALER_EXCHANGE_get_keys (is->exchange), (TALER_EXCHANGE_get_keys (is->exchange),
&ws->amount); &ws->amount);
@ -365,9 +365,9 @@ withdraw_traits (void *cls,
TALER_TESTING_interpreter_fail (ws->is); TALER_TESTING_interpreter_fail (ws->is);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (NULL == ws->exchange_url)
ws->exchange_url = GNUNET_strdup ws->exchange_url
(TALER_EXCHANGE_get_base_url (ws->is->exchange)); = GNUNET_strdup (TALER_EXCHANGE_get_base_url (ws->is->exchange));
struct TALER_TESTING_Trait traits[] = { struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_coin_priv (0 /* only one coin */, TALER_TESTING_make_trait_coin_priv (0 /* only one coin */,
@ -383,7 +383,6 @@ withdraw_traits (void *cls,
TALER_TESTING_make_trait_amount_obj (0, TALER_TESTING_make_trait_amount_obj (0,
&ws->amount), &ws->amount),
TALER_TESTING_make_trait_url (0, ws->exchange_url), TALER_TESTING_make_trait_url (0, ws->exchange_url),
TALER_TESTING_trait_end () TALER_TESTING_trait_end ()
}; };