[gom] gom: Fix another memory management problem in GomFilter
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gom] gom: Fix another memory management problem in GomFilter
- Date: Wed, 16 Jul 2014 14:15:51 +0000 (UTC)
commit a70533c2ecbc18a0787ec4f1178c8b8ac3e6f2b1
Author: Bastien Nocera <hadess hadess net>
Date: Wed Jul 16 16:13:52 2014 +0200
gom: Fix another memory management problem in GomFilter
Follow-up to 93694570fde8e29dff132644baa2efb18ef31ff5.
When appended to the target array, the values aren't refcounted, so
destroying the whole source array would destroy the values as well.
Disable the freeing of the individual items in the source array so
that they're not destroyed along with the source array. The destination
array will now assume ownership.
gom/gom-filter.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gom/gom-filter.c b/gom/gom-filter.c
index d8ccda8..49cd05b 100644
--- a/gom/gom-filter.c
+++ b/gom/gom-filter.c
@@ -332,6 +332,8 @@ join_value_array (GArray *dst,
g_return_if_fail(src);
g_array_append_vals(dst, src->data, src->len);
+ g_array_set_clear_func(src, NULL);
+ g_array_unref(src);
}
/**
@@ -382,7 +384,6 @@ gom_filter_get_values (GomFilter *filter)
va = gom_filter_get_values(priv->left);
tmp = gom_filter_get_values(priv->right);
join_value_array(va, tmp);
- g_array_unref(tmp);
return va;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]