@@ -78,7 +78,7 @@ func (w *Flushable) Put(key []byte, value []byte) error {
7878}
7979
8080func (w * Flushable ) put (key []byte , value []byte ) {
81- w .modified .Put (key , common .CopyBytes (value ))
81+ w .modified .Put (common . CopyBytes ( key ) , common .CopyBytes (value ))
8282 * w .sizeEstimation += len (key ) + len (value ) + 128
8383}
8484
@@ -91,7 +91,7 @@ func (w *flushableReader) Has(key []byte) (bool, error) {
9191 return false , errClosed
9292 }
9393
94- val , ok := w .modified .Get (key )
94+ val , ok := w .modified .Get (common . CopyBytes ( key ) )
9595 if ok {
9696 return val != nil , nil
9797 }
@@ -108,7 +108,7 @@ func (w *flushableReader) Get(key []byte) ([]byte, error) {
108108 return nil , errClosed
109109 }
110110
111- if entry , ok := w .modified .Get (key ); ok {
111+ if entry , ok := w .modified .Get (common . CopyBytes ( key ) ); ok {
112112 if entry == nil {
113113 return nil , nil
114114 }
@@ -128,7 +128,7 @@ func (w *Flushable) Delete(key []byte) error {
128128}
129129
130130func (w * Flushable ) delete (key []byte ) {
131- w .modified .Put (key , nil )
131+ w .modified .Put (common . CopyBytes ( key ) , nil )
132132 * w .sizeEstimation += len (key ) + 128 // it should be (len(key) - len(old value)), but we'd need to read old value
133133}
134134
@@ -296,7 +296,7 @@ func castToPair(node *rbt.Node) (key, val []byte) {
296296func (it * flushableIterator ) init () {
297297 it .parentOk = it .parentIt .Next ()
298298 if len (it .start ) != 0 {
299- it .treeNode , it .treeOk = it .tree .Ceiling (it .start ) // not strict >=
299+ it .treeNode , it .treeOk = it .tree .Ceiling (common . CopyBytes ( it .start ) ) // not strict >=
300300 } else {
301301 it .treeNode = it .tree .Left () // lowest key
302302 it .treeOk = it .treeNode != nil
0 commit comments