r17740: get rid of dependence on asprintf(), using talloc_asprintf() instead
authorAndrew Tridgell <tridge@samba.org>
Wed, 23 Aug 2006 05:08:55 +0000 (05:08 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:16:34 +0000 (14:16 -0500)
(This used to be commit 0e350ea0c1bba278995da5e8de677c5651eb623e)

source4/lib/ldb/tools/ldbedit.c
source4/lib/ldb/tools/ldbtest.c

index f2cbeedb64975ff36b2a2c7b5b72f9c09fab4d65..24df98d72873d1111d79ab73b91b941f49e0ec0f 100644 (file)
@@ -219,7 +219,7 @@ static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1, int coun
 
        fclose(f);
 
-       asprintf(&cmd, "%s %s", editor, template);
+       cmd = talloc_asprintf(ldb, "%s %s", editor, template);
 
        if (!cmd) {
                unlink(template);
@@ -229,7 +229,7 @@ static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1, int coun
 
        /* run the editor */
        ret = system(cmd);
-       free(cmd);
+       talloc_free(cmd);
 
        if (ret != 0) {
                unlink(template);
index 62d8b84061ac4f32275d66903e1f851bac32b07e..98449ae16bea736ec7fc82a1eac6e426775cd619 100644 (file)
@@ -225,7 +225,7 @@ static void search_uid(struct ldb_context *ldb, struct ldb_dn *basedn, int nreco
                struct ldb_result *res = NULL;
                int ret;
 
-               asprintf(&expr, "(uid=TEST%d)", uid);
+               expr = talloc_asprintf(ldb, "(uid=TEST%d)", uid);
                ret = ldb_search(ldb, basedn, LDB_SCOPE_SUBTREE, expr, NULL, &res);
 
                if (ret != LDB_SUCCESS || (uid < nrecords && res->count != 1)) {
@@ -242,7 +242,7 @@ static void search_uid(struct ldb_context *ldb, struct ldb_dn *basedn, int nreco
                fflush(stdout);
 
                talloc_free(res);
-               free(expr);
+               talloc_free(expr);
        }
 
        printf("\n");