incomplete leak fixes

This commit is contained in:
Christian Grothoff 2019-09-15 11:18:31 +02:00
parent cbfa534194
commit 7dca6dacb9
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -898,17 +898,13 @@ cmd_init (struct PERF_TALER_EXCHANGEDB_Cmd cmd[])
static int static int
cmd_clean (struct PERF_TALER_EXCHANGEDB_Cmd cmd[]) cmd_clean (struct PERF_TALER_EXCHANGEDB_Cmd cmd[])
{ {
unsigned int i; for (unsigned int i = 0; PERF_TALER_EXCHANGEDB_CMD_END != cmd[i].command; i++)
for (i = 0; PERF_TALER_EXCHANGEDB_CMD_END != cmd[i].command; i++)
{ {
switch (cmd[i].command) switch (cmd[i].command)
{ {
case PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY: case PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY:
{ {
unsigned int j; for (unsigned int j = 0; j < cmd[i].details.save_array.nb_saved; j++)
for (j = 0; j < cmd[i].details.save_array.nb_saved; j++)
{ {
data_free (&cmd[i].details.save_array.data_saved[j]); data_free (&cmd[i].details.save_array.data_saved[j]);
} }
@ -921,7 +917,9 @@ cmd_clean (struct PERF_TALER_EXCHANGEDB_Cmd cmd[])
GNUNET_free (cmd[i].details.load_array.permutation); GNUNET_free (cmd[i].details.load_array.permutation);
cmd[i].details.load_array.permutation = NULL; cmd[i].details.load_array.permutation = NULL;
break; break;
case PERF_TALER_EXCHANGEDB_CMD_CREATE_WITHDRAW:
PERF_TALER_EXCHANGEDB_coin_free (cmd[i].exposed.data.coin);
break;
default: default:
break; break;
} }
@ -1578,7 +1576,10 @@ PERF_TALER_EXCHANGEDB_interpret (struct TALER_EXCHANGEDB_Plugin *db_plugin,
return ret; return ret;
state.session = db_plugin->get_session (db_plugin->cls); state.session = db_plugin->get_session (db_plugin->cls);
if (NULL == state.session) if (NULL == state.session)
{
cmd_clean (cmd);
return GNUNET_SYSERR; return GNUNET_SYSERR;
}
GNUNET_assert (NULL != state.session); GNUNET_assert (NULL != state.session);
ret = interpret (&state); ret = interpret (&state);
cmd_clean (cmd); cmd_clean (cmd);