dbwrap: use talloc_stackframe() in db_tdb_log_key()
authorAndrew Bartlett <abartlet@samba.org>
Wed, 24 Oct 2012 07:23:04 +0000 (18:23 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 25 Oct 2012 11:19:59 +0000 (22:19 +1100)
We can not be sure that there is already a talloc_stackframe() in place
so we must create one.

Andrew Bartlett

lib/dbwrap/dbwrap_tdb.c

index 80d41b4ebb8d0024b9fba62f275e0ff4bba9d08c..a3a6c878a53d7ab3a3d4264d5eb8b9a26b4693ad 100644 (file)
@@ -42,10 +42,11 @@ static void db_tdb_log_key(const char *prefix, TDB_DATA key)
 {
        size_t len;
        char *keystr;
-
+       TALLOC_CTX *frame;
        if (DEBUGLEVEL < 10) {
                return;
        }
+       frame = talloc_stackframe();
        len = key.dsize;
        if (DEBUGLEVEL == 10) {
                /*
@@ -53,10 +54,10 @@ static void db_tdb_log_key(const char *prefix, TDB_DATA key)
                 */
                len = MIN(10, key.dsize);
        }
-       keystr = hex_encode_talloc(talloc_tos(), (unsigned char *)(key.dptr),
+       keystr = hex_encode_talloc(frame, (unsigned char *)(key.dptr),
                                   len);
        DEBUG(10, ("%s key %s\n", prefix, keystr));
-       TALLOC_FREE(keystr);
+       TALLOC_FREE(frame);
 }
 
 static int db_tdb_record_destr(struct db_record* data)