ctdb-tools/ctdb: Unlock records before closing tdb database
authorAmitay Isaacs <amitay@gmail.com>
Wed, 23 Apr 2014 01:44:20 +0000 (11:44 +1000)
committerMichael Adam <obnox@samba.org>
Wed, 23 Apr 2014 12:49:07 +0000 (14:49 +0200)
Now freeing ctdb_db context will close the tdb database.  So make sure
all the locks are released (by freeing record handles or memory context
from which record handles are allocated) before freeing ctdb_db context.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
ctdb/tools/ctdb.c

index 4afb3e7af7b5b1afd675d5096974bf63f7b65a35..624c61c2f80e1fca0dc0a86d70bacd832379d70d 100644 (file)
@@ -3842,8 +3842,8 @@ static int control_readkey(struct ctdb_context *ctdb, int argc, const char **arg
 
        printf("Data: size:%d ptr:[%.*s]\n", (int)data.dsize, (int)data.dsize, data.dptr);
 
-       talloc_free(ctdb_db);
        talloc_free(tmp_ctx);
+       talloc_free(ctdb_db);
        return 0;
 }
 
@@ -3892,8 +3892,8 @@ static int control_writekey(struct ctdb_context *ctdb, int argc, const char **ar
        }
 
        talloc_free(h);
-       talloc_free(ctdb_db);
        talloc_free(tmp_ctx);
+       talloc_free(ctdb_db);
        return 0;
 }