summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormbkma <[email protected]>2021-03-17 23:30:01 +0100
committerRobert Antoni Buj Gelonch <[email protected]>2021-03-18 09:19:12 +0100
commit8aab08d696282ff5c855ee22d2314fe5fcb3ad64 (patch)
tree22a20f8b022766c59d0573ea171b3bf57a3437dd
parent248867c85dbaffb5fa927f6c1b83caf38284452b (diff)
downloadmate-calc-8aab08d696282ff5c855ee22d2314fe5fcb3ad64.tar.bz2
mate-calc-8aab08d696282ff5c855ee22d2314fe5fcb3ad64.tar.xz
math-buttons: fix memory leaks reported by valgrind
-rw-r--r--src/math-buttons.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/math-buttons.c b/src/math-buttons.c
index dce4f33..b2cb131 100644
--- a/src/math-buttons.c
+++ b/src/math-buttons.c
@@ -354,7 +354,7 @@ load_finc_dialogs(MathButtons *buttons)
static void
update_bit_panel(MathButtons *buttons)
{
- MPNumber x = mp_new();
+ MPNumber x;
gboolean enabled;
guint64 bits;
int i;
@@ -364,6 +364,7 @@ update_bit_panel(MathButtons *buttons)
if (!buttons->priv->bit_panel)
return;
+ x = mp_new();
enabled = math_equation_get_number(buttons->priv->equation, &x);
if (enabled) {
@@ -384,7 +385,10 @@ update_bit_panel(MathButtons *buttons)
gtk_widget_set_sensitive(buttons->priv->base_label, enabled);
if (!enabled)
+ {
+ mp_clear(&x);
return;
+ }
for (i = 0; i < MAXBITS; i++) {
const gchar *bin_label;