[couchdb-glib/wip/query-response] Free memory in property setters
- From: Krzysztof Klimonda <kklimonda src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [couchdb-glib/wip/query-response] Free memory in property setters
- Date: Fri, 19 Nov 2010 17:00:37 +0000 (UTC)
commit 9916d69127c8e030af5920014c5157e792c40c53
Author: Krzysztof Klimonda <kklimonda syntaxhighlighted com>
Date: Fri Nov 19 17:59:05 2010 +0100
Free memory in property setters
All property setters were leaking memory on setting new values,
make sure we free before assigning.
couchdb-glib/couchdb-query.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/couchdb-glib/couchdb-query.c b/couchdb-glib/couchdb-query.c
index 21b772a..686efc8 100644
--- a/couchdb-glib/couchdb-query.c
+++ b/couchdb-glib/couchdb-query.c
@@ -76,9 +76,12 @@ couchdb_query_set_property (GObject *object, guint property_id,
switch (property_id) {
case PROP_QUERY_OPTIONS:
+ if (self->priv->query_options)
+ g_hash_table_destroy (self->priv->query_options);
self->priv->query_options = g_value_get_boxed (value);
break;
case PROP_PATH:
+ g_free (self->priv->path);
self->priv->path = g_strdup (g_value_get_string (value));
break;
default:
@@ -277,6 +280,8 @@ couchdb_query_set_json_object (CouchdbQuery *self, JsonObject *body)
{
g_return_if_fail (COUCHDB_IS_QUERY (self));
+ if (self->priv->body)
+ json_object_unref (self->priv->body);
self->priv->body = json_object_ref (body);
}
@@ -285,6 +290,7 @@ couchdb_query_set_path (CouchdbQuery *self, const char *path)
{
g_return_if_fail (COUCHDB_IS_QUERY (self));
+ g_free (self->priv->path);
self->priv->path = g_strdup (path);
}
@@ -301,6 +307,7 @@ couchdb_query_set_method (CouchdbQuery *self, const gchar *method)
{
g_return_if_fail (COUCHDB_IS_QUERY (self));
+ g_free (self->priv->method);
self->priv->method = g_strdup (method);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]