=== modified file 'storage/leveldb/ha_leveldb.cc'
--- storage/leveldb/ha_leveldb.cc	2013-05-16 14:34:40 +0000
+++ storage/leveldb/ha_leveldb.cc	2013-05-22 10:27:05 +0000
@@ -188,7 +188,24 @@
 {
   leveldb::Slice a_slice((char*)a, a_len);
   leveldb::Slice b_slice((char*)b, b_len);
-  return primary_key_comparator.Compare(a_slice, b_slice);
+  if ((a[0]==0xFE && a[1]==0xAD) || 
+      (b[0]==0xFE && b[1]==0xAD))
+  {
+    fprintf(stderr,"a parameter was freed!\n");
+    a= NULL; // lets crash
+    b= NULL;
+  }
+  
+  int res= primary_key_comparator.Compare(a_slice, b_slice);
+
+  if ((a[0]==0xFE && a[1]==0xAD) || 
+      (b[0]==0xFE && b[1]==0xAD))
+  {
+    fprintf(stderr,"a parameter was freed (2)!\n");
+    a= NULL; // lets crash
+    b= NULL;
+  }
+  return res;
 }
 
 
@@ -1672,11 +1689,11 @@
 
 void ha_leveldb::unlock_row()
 {
-  if (lock_rows)
+ /* if (lock_rows)
   {
     Ldb_transaction *trx= get_or_create_trx(table->in_use);
     trx->release_last_lock();
-  }
+  }*/
 }
 
 

=== modified file 'storage/leveldb/ldb_locks.cc'
--- storage/leveldb/ldb_locks.cc	2013-03-08 16:20:20 +0000
+++ storage/leveldb/ldb_locks.cc	2013-05-22 09:11:00 +0000
@@ -302,9 +302,15 @@
     /* Nobody's waiting. Release the lock */
     char *rowkey= own_lock->rowkey;
     own_lock->deleted= true;
+
     mysql_mutex_unlock(&own_lock->mutex);
     int res= lf_hash_delete(&lf_hash, pins, own_lock->rowkey, own_lock->len);
     DBUG_ASSERT(res == 0);
+    //psergey:
+    rowkey[0]=0xFE;
+    rowkey[1]=0xAD;
+    rowkey[2]=0xFE;
+    rowkey[3]=0xAD;
     my_free(rowkey);
   }
 }


