Skip to content

Commit

Permalink
Fix pointer value assignment in baseMultiCommand.parseKey
Browse files Browse the repository at this point in the history
  • Loading branch information
reugn committed Jul 17, 2024
1 parent 35c6409 commit 99ff8f0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions multi_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,10 @@ func (cmd *baseMultiCommand) parseKey(fieldCount int, bval *int64) (*Key, Error)
return nil, err.setNode(cmd.node)
}
case BVAL_ARRAY:
v := Buffer.LittleBytesToInt64(cmd.dataBuffer, 1)
bval = &v
if bval != nil {
v := Buffer.LittleBytesToInt64(cmd.dataBuffer, 1)
*bval = v
}
}
}

Expand Down Expand Up @@ -292,8 +294,8 @@ func (cmd *baseMultiCommand) parseRecordResults(ifc command, receiveSize int) (b
fieldCount := int(Buffer.BytesToUint16(cmd.dataBuffer, 18))
opCount := int(Buffer.BytesToUint16(cmd.dataBuffer, 20))

var bval *int64
key, err := cmd.parseKey(fieldCount, bval)
var bval int64
key, err := cmd.parseKey(fieldCount, &bval)
if err != nil {
err = newNodeError(cmd.node, err)
return false, err
Expand Down Expand Up @@ -366,7 +368,7 @@ func (cmd *baseMultiCommand) parseRecordResults(ifc command, receiveSize int) (b
// block forever, or panic in case the channel is closed in the meantime.
select {
// send back the result on the async channel
case cmd.recordset.records <- &Result{Record: newRecord(cmd.node, key, bins, generation, expiration), Err: nil, BVal: bval}:
case cmd.recordset.records <- &Result{Record: newRecord(cmd.node, key, bins, generation, expiration), Err: nil, BVal: &bval}:
case <-cmd.recordset.cancelled:
switch cmd.terminationErrorType {
case types.SCAN_TERMINATED:
Expand Down Expand Up @@ -404,7 +406,7 @@ func (cmd *baseMultiCommand) parseRecordResults(ifc command, receiveSize int) (b
if cmd.terminationErrorType == types.SCAN_TERMINATED {
cmd.tracker.setDigest(cmd.nodePartitions, key)
} else {
cmd.tracker.setLast(cmd.nodePartitions, key, bval)
cmd.tracker.setLast(cmd.nodePartitions, key, &bval)
}
}
}
Expand Down

0 comments on commit 99ff8f0

Please sign in to comment.