[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/5] var-type-dialog: Fix possible memory leaks.
From: |
Ben Pfaff |
Subject: |
[PATCH 2/5] var-type-dialog: Fix possible memory leaks. |
Date: |
Mon, 16 Jul 2012 23:45:53 -0700 |
gtk_tree_model_get_value() documentation says:
When done with value, g_value_unset() needs to be called to free
any allocated memory.
but none of the users in this file did that.
---
src/ui/gui/var-type-dialog.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/ui/gui/var-type-dialog.c b/src/ui/gui/var-type-dialog.c
index 786b0c4..aa46ca4 100644
--- a/src/ui/gui/var-type-dialog.c
+++ b/src/ui/gui/var-type-dialog.c
@@ -290,6 +290,8 @@ set_format_from_treeview (GtkTreeView *treeview, gpointer
data)
gtk_tree_model_get_value (model, &iter, 1, &the_value);
dialog->fmt_l = *(struct fmt_spec *) g_value_get_pointer (&the_value);
+
+ g_value_unset (&the_value);
}
@@ -313,6 +315,8 @@ set_format_type_from_treeview (GtkTreeView *treeview,
gpointer data)
dialog->fmt_l = custom_format;
dialog->fmt_l.type = *(int*) g_value_get_pointer (&the_value);
+
+ g_value_unset (&the_value);
}
@@ -589,6 +593,8 @@ select_treeview_from_format (GtkTreeView *treeview, const
struct fmt_spec *fmt)
spec = g_value_get_pointer (&value);
+ g_value_unset (&value);
+
if ( 0 == memcmp (spec, fmt, sizeof (struct fmt_spec)))
{
break;
@@ -636,6 +642,8 @@ select_treeview_from_format_type (GtkTreeView *treeview,
spec = * ((int *) g_value_get_pointer (&value));
+ g_value_unset (&value);
+
if ( spec == fmt_type)
break;
}
--
1.7.2.5
- [PATCH 0/5] more var-type-dialog improvements, Ben Pfaff, 2012/07/17
- [PATCH 1/5] var-type-dialog: Avoid string copy setting up currency treeview., Ben Pfaff, 2012/07/17
- [PATCH 2/5] var-type-dialog: Fix possible memory leaks.,
Ben Pfaff <=
- [PATCH 4/5] format: Make fmt_date_template() human-friendly, respect field width., Ben Pfaff, 2012/07/17
- [PATCH 5/5] var-type-dialog: Use fmt_date_template() to reduce duplication., Ben Pfaff, 2012/07/17
- [PATCH 3/5] var-type-dialog: Use G_TYPE_INT to store an int., Ben Pfaff, 2012/07/17
- Re: [PATCH 0/5] more var-type-dialog improvements, John Darrington, 2012/07/17