Create local copy of temporary cursor currKey

Temporary value returned by cursor->currKey() may be overwritten
before we can iterate over it, so copy it first.