Browse Source

Merge pull request #4579 from heyitsanthony/txn-fix-if-clobber

clientv3: copy correct pointers into txn comparisons
Anthony Romano 9 years ago
parent
commit
5dfcdae521
1 changed files with 2 additions and 2 deletions
  1. 2 2
      clientv3/txn.go

+ 2 - 2
clientv3/txn.go

@@ -85,8 +85,8 @@ func (txn *txn) If(cs ...Cmp) Txn {
 
 
 	txn.cif = true
 	txn.cif = true
 
 
-	for _, cmp := range cs {
-		txn.cmps = append(txn.cmps, (*pb.Compare)(&cmp))
+	for i := range cs {
+		txn.cmps = append(txn.cmps, (*pb.Compare)(&cs[i]))
 	}
 	}
 
 
 	return txn
 	return txn