[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4195-gf495968

Jeremy Allison jra at samba.org
Mon Sep 29 18:28:52 GMT 2008


The branch, v3-3-test has been updated
       via  f495968c88f07b74a943da9e034084b72f5a1c8b (commit)
      from  c48fd3cee0a91617123d79bccff7ec1f6008fb26 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit f495968c88f07b74a943da9e034084b72f5a1c8b
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Sep 29 11:27:31 2008 -0700

    fixed a segfault on the ctdb destructor code

-----------------------------------------------------------------------

Summary of changes:
 source/lib/dbwrap_ctdb.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/dbwrap_ctdb.c b/source/lib/dbwrap_ctdb.c
index 7c1ef8f..e82e75d 100644
--- a/source/lib/dbwrap_ctdb.c
+++ b/source/lib/dbwrap_ctdb.c
@@ -403,8 +403,9 @@ static struct db_record *db_ctdb_fetch_locked_transaction(struct db_ctdb_ctx *ct
 	return result;
 }
 
-static int db_ctdb_record_destructor(struct db_record *rec)
+static int db_ctdb_record_destructor(struct db_record **recp)
 {
+	struct db_record *rec = talloc_get_type_abort(*recp, struct db_record);
 	struct db_ctdb_transaction_handle *h = talloc_get_type_abort(
 		rec->private_data, struct db_ctdb_transaction_handle);
 	int ret = h->ctx->db->transaction_commit(h->ctx->db);
@@ -422,7 +423,7 @@ static struct db_record *db_ctdb_fetch_locked_persistent(struct db_ctdb_ctx *ctx
 							 TDB_DATA key)
 {
 	int res;
-	struct db_record *rec;
+	struct db_record *rec, **recp;
 
 	res = db_ctdb_transaction_start(ctx->db);
 	if (res == -1) {
@@ -436,7 +437,13 @@ static struct db_record *db_ctdb_fetch_locked_persistent(struct db_ctdb_ctx *ctx
 	}
 
 	/* destroy this transaction when we release the lock */
-	talloc_set_destructor((struct db_record *)talloc_new(rec), db_ctdb_record_destructor);
+	recp = talloc(rec, struct db_record *);
+	if (recp == NULL) {
+		ctx->db->transaction_cancel(ctx->db);
+		return NULL;
+	}
+	*recp = rec;
+	talloc_set_destructor(recp, db_ctdb_record_destructor);
 	return rec;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list