From b0117b1d5ae73916c6f0d289be1f693bb5f46824 Mon Sep 17 00:00:00 2001 From: mbkma Date: Thu, 5 Mar 2020 13:06:45 +0100 Subject: Port to GNU MPFR/MPC Library For further information please visit: https://www.mpfr.org/ http://www.multiprecision.org/mpc --- src/math-variables.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/math-variables.c') diff --git a/src/math-variables.c b/src/math-variables.c index 225ca9c..b44b387 100644 --- a/src/math-variables.c +++ b/src/math-variables.c @@ -59,10 +59,14 @@ registers_load(MathVariables *variables) value = g_strstrip(value); t = g_malloc(sizeof(MPNumber)); + *t = mp_new(); if (mp_set_from_string(value, 10, t) == 0) g_hash_table_insert(variables->priv->registers, g_strdup(name), t); else + { + mp_clear(t); g_free(t); + } } fclose(f); } @@ -135,6 +139,7 @@ math_variables_set(MathVariables *variables, const char *name, const MPNumber *v g_return_if_fail(value != NULL); t = g_malloc(sizeof(MPNumber)); + *t = mp_new(); mp_set_from_mp(value, t); g_hash_table_insert(variables->priv->registers, g_strdup(name), t); registers_save(variables); -- cgit v1.2.1