Use talloc_tos() in secrets_init
authorVolker Lendecke <vl@samba.org>
Sun, 9 Mar 2008 10:17:48 +0000 (11:17 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 10 Mar 2008 08:51:51 +0000 (09:51 +0100)
(This used to be commit 27065382d9b692b5885265c9d60ffb7ec7748c38)

source3/passdb/secrets.c

index 6c5375e7de8baa0007379df7ca82e483e1e282dc..e4f1744bfdfb5b3c534906b0088e0d5bbebf97b8 100644 (file)
@@ -51,22 +51,15 @@ static void get_rand_seed(int *new_seed)
 /* open up the secrets database */
 bool secrets_init(void)
 {
-       TALLOC_CTX *ctx;
        char *fname = NULL;
        unsigned char dummy;
 
        if (tdb)
                return True;
 
-       ctx = talloc_init("secrets_init");
-       if (!ctx) {
-               return false;
-       }
-       fname = talloc_asprintf(ctx,
-                       "%s/secrets.tdb",
-                       lp_private_dir());
-       if (!fname) {
-               TALLOC_FREE(ctx);
+       fname = talloc_asprintf(talloc_tos(), "%s/secrets.tdb",
+                               lp_private_dir());
+       if (fname == NULL) {
                return false;
        }
 
@@ -74,11 +67,11 @@ bool secrets_init(void)
 
        if (!tdb) {
                DEBUG(0,("Failed to open %s\n", fname));
-               TALLOC_FREE(ctx);
+               TALLOC_FREE(fname);
                return False;
        }
 
-       TALLOC_FREE(ctx);
+       TALLOC_FREE(fname);
 
        /**
         * Set a reseed function for the crypto random generator