[PATCH] Fix uninitialized variable in source4/winbind/idmap.c

Michele Baldessari michele at acksyn.org
Sun Sep 9 12:44:01 MDT 2012

Set trans to a value that is not LDB_SUCCESS (all LDB_ constants are
positive) so that any "goto failed:" call does not end up calling 
ldb_transaction_cancel() if trans is initialized to 0 (LDB_SUCCESS) 
by chance.

 source4/winbind/idmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source4/winbind/idmap.c b/source4/winbind/idmap.c
index 976a2d0..a6cc88f 100644
--- a/source4/winbind/idmap.c
+++ b/source4/winbind/idmap.c
@@ -387,7 +387,7 @@ static NTSTATUS idmap_sid_to_xid(struct idmap_context *idmap_ctx,
 	struct ldb_dn *dn;
 	struct ldb_message *hwm_msg, *map_msg, *sam_msg;
 	struct ldb_result *res = NULL;
-	int trans;
+	int trans = -1;
 	uint32_t low, high, hwm, new_xid;
 	char *sid_string, *unixid_string, *hwm_string;
 	bool hwm_entry_exists;

Michele Baldessari            <michele at acksyn.org>
C2A5 9DA3 9961 4FFB E01B  D0BC DDD4 DCCB 7515 5C6D

More information about the samba-technical mailing list