diff options
Diffstat (limited to 'src/math-variables.c')
-rw-r--r-- | src/math-variables.c | 5 |
1 files changed, 5 insertions, 0 deletions
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); |