[evolution-data-server] Fix memory leak in error paths in EBookBackendSqliteDB::sexp_to_sql_query()



commit d7f6518cfe1766a5a9602bf017890bf12809718d
Author: Milan Crha <mcrha redhat com>
Date:   Mon Mar 21 12:05:47 2016 +0100

    Fix memory leak in error paths in EBookBackendSqliteDB::sexp_to_sql_query()

 .../libedata-book/e-book-backend-sqlitedb.c        |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend-sqlitedb.c 
b/addressbook/libedata-book/e-book-backend-sqlitedb.c
index d39ca3a..10334f6 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -4011,12 +4011,17 @@ sexp_to_sql_query (EBookBackendSqliteDB *ebsdb,
 
        e_sexp_input_text (sexp, query, strlen (query));
 
-       if (e_sexp_parse (sexp) == -1)
+       if (e_sexp_parse (sexp) == -1) {
+               e_sexp_unref (sexp);
                return NULL;
+       }
 
        r = e_sexp_eval (sexp);
-       if (!r)
+       if (!r) {
+               e_sexp_unref (sexp);
                return NULL;
+       }
+
        if (r->type == ESEXP_RES_STRING) {
                if (r->value.string && *r->value.string)
                        res = g_strdup (r->value.string);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]