From ec3a4aad2322ad1158372cf293d202c6890ce124 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 17 Feb 2019 00:22:28 +0100 Subject: fix memory leak of rhistory, always allocate it on the heap --- src/lib/exchange_api_reserve.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/exchange_api_reserve.c b/src/lib/exchange_api_reserve.c index d4d0cb9a1..9c0ff6d7a 100644 --- a/src/lib/exchange_api_reserve.c +++ b/src/lib/exchange_api_reserve.c @@ -447,6 +447,7 @@ free_rhistory (struct TALER_EXCHANGE_ReserveHistory *rhistory, break; } } + GNUNET_free (rhistory); } @@ -503,9 +504,10 @@ handle_reserve_status_finished (void *cls, } len = json_array_size (history); { - struct TALER_EXCHANGE_ReserveHistory rhistory[len]; + struct TALER_EXCHANGE_ReserveHistory *rhistory; - memset (rhistory, 0, sizeof (rhistory)); + rhistory = GNUNET_new_array (len, + struct TALER_EXCHANGE_ReserveHistory); if (GNUNET_OK != parse_reserve_history (rsh->exchange, history, -- cgit v1.2.3