r5189: fixed a double free bug in the ltdb indexing code
authorAndrew Tridgell <tridge@samba.org>
Thu, 3 Feb 2005 04:03:28 +0000 (04:03 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:09:29 +0000 (13:09 -0500)
(This used to be commit 7be0bc93bd6757e52fd10bd3d3b3d1a8f5221452)

source4/lib/ldb/ldb_tdb/ldb_index.c

index af325f920375751bc7393b8a6942b894dfecc7c0..c7dc9f13451b07be5f0851cd7325906617d0ac16 100644 (file)
@@ -209,7 +209,6 @@ static int ltdb_index_dn_simple(struct ldb_module *module,
                        list->dn[list->count] = 
                                talloc_strdup(list->dn, (char *)el->values[j].data);
                        if (!list->dn[list->count]) {
-                               talloc_free(list);
                                return -1;
                        }
                        list->count++;
@@ -309,7 +308,6 @@ static int list_intersect(struct ldb_context *ldb,
 
        if (list->count == 0 || list2->count == 0) {
                /* 0 & X == 0 */
-               talloc_free(list);
                return 0;
        }
 
@@ -320,7 +318,6 @@ static int list_intersect(struct ldb_context *ldb,
 
        list3->dn = talloc_array(list3, char *, list->count);
        if (!list3->dn) {
-               talloc_free(list);
                talloc_free(list3);
                return -1;
        }
@@ -359,13 +356,11 @@ static int list_union(struct ldb_context *ldb,
 
        if (list->count == 0 && list2->count == 0) {
                /* 0 | 0 == 0 */
-               talloc_free(list);
                return 0;
        }
 
        d = talloc_realloc(list, list->dn, char *, list->count + list2->count);
        if (!d) {
-               talloc_free(list);
                return -1;
        }
        list->dn = d;
@@ -375,7 +370,6 @@ static int list_union(struct ldb_context *ldb,
                              sizeof(char *), (comparison_fn_t)strcmp) == -1) {
                        list->dn[list->count] = talloc_strdup(list->dn, list2->dn[i]);
                        if (!list->dn[list->count]) {
-                               talloc_free(list);
                                return -1;
                        }
                        list->count++;
@@ -453,7 +447,6 @@ static int ltdb_index_dn_or(struct ldb_module *module,
        }
 
        if (list->count == 0) {
-               talloc_free(list);
                return 0;
        }