Merge lp://qastaging/~kklimonda/couchdb-glib/fix-memleaks into lp://qastaging/couchdb-glib

Proposed by Krzysztof Klimonda
Status: Merged
Merge reported by: Rodrigo Moya
Merged at revision: not available
Proposed branch: lp://qastaging/~kklimonda/couchdb-glib/fix-memleaks
Merge into: lp://qastaging/couchdb-glib
Diff against target: 32 lines (+8/-2)
1 file modified
couchdb-glib/couchdb-session.c (+8/-2)
To merge this branch: bzr merge lp://qastaging/~kklimonda/couchdb-glib/fix-memleaks
Reviewer Review Type Date Requested Status
Rodrigo Moya (community) Approve
Review via email: mp+34541@code.qastaging.launchpad.net

Description of the change

Fixes two more small memleaks - url created by g_strdup_printf and dbinfo created in couchdb_session_get_database ().

To post a comment you must log in.
Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

There is a little mistake, you are calling couchdb_database_new twice. So fixed and pushed this to GIT master:

diff --git a/couchdb-glib/couchdb-session.c b/couchdb-glib/couchdb-session.c
index 9d38fd7..c995751 100644
--- a/couchdb-glib/couchdb-session.c
+++ b/couchdb-glib/couchdb-session.c
@@ -319,6 +319,7 @@ couchdb_session_get_database_info (CouchdbSession *session,
                }
        }
        g_object_unref (G_OBJECT (parser));
+ g_free (url);

        return result;
 }
@@ -343,8 +344,14 @@ couchdb_session_get_database (CouchdbSession *session, cons
        g_return_val_if_fail (dbname != NULL, NULL);

        dbinfo = couchdb_session_get_database_info (session, dbname, error);
- if (dbinfo != NULL)
- return couchdb_database_new (session, dbname);
+ if (dbinfo != NULL) {
+ CouchdbDatabase *db;
+
+ db = couchdb_database_new (session, dbname);
+ couchdb_database_info_unref (dbinfo);
+
+ return db;
+ }

        return NULL;
 }

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches