Program: 30807
Project: 30807
Buggy source:
public void applyTransitionIndexToSymbolMapReaders(long pTransitionIndex){
  final int columnCount=Unsafe.getUnsafe().getInt(pTransitionIndex + 4);
  final long index=pTransitionIndex + 8;
  final long stateAddress=index + columnCount * 8;
  if (columnCount > this.columnCount) {
    symbolMapReaders.setPos(columnCount);
  }
  Unsafe.getUnsafe().setMemory(stateAddress,columnCount,(byte)0);
  for (int i=0; i < columnCount; i++) {
    if (Unsafe.getUnsafe().getByte(stateAddress + i) == -1) {
      continue;
    }
    Unsafe.getUnsafe().putByte(stateAddress + i,(byte)-1);
    int copyFrom=Unsafe.getUnsafe().getInt(index + i * 8);
    if (copyFrom == i + 1) {
      continue;
    }
    SymbolMapReaderImpl tmp;
    if (copyFrom > 0) {
      tmp=symbolMapReaders.getAndSetQuick(copyFrom - 1,null);
      tmp=symbolMapReaders.getAndSetQuick(i,tmp);
      int copyTo=Unsafe.getUnsafe().getInt(index + i * 8 + 4);
      while (copyTo > 0) {
        if (Unsafe.getUnsafe().getByte(stateAddress + copyTo - 1) == -1) {
          break;
        }
        Unsafe.getUnsafe().putByte(stateAddress + copyTo - 1,(byte)-1);
        tmp=symbolMapReaders.getAndSetQuick(copyTo - 1,tmp);
        copyTo=Unsafe.getUnsafe().getInt(index + (copyTo - 1) * 8 + 4);
      }
      Misc.free(tmp);
    }
 else {
      RecordColumnMetadata m=metadata.getColumnQuick(i);
      if (m.getType() == ColumnType.SYMBOL) {
        SymbolMapReaderImpl reader=new SymbolMapReaderImpl(configuration,path,m.getName(),0);
        tmp=symbolMapReaders.getAndSetQuick(i,reader);
        Misc.free(tmp);
      }
 else {
        Misc.free(symbolMapReaders.getAndSetQuick(i,null));
      }
    }
  }
  if (columnCount < this.columnCount) {
    for (int i=columnCount; i < this.columnCount; i++) {
      Misc.free(symbolMapReaders.getQuick(i));
    }
    symbolMapReaders.setPos(columnCount);
  }
}

Fixed version (ground truth):
public void applyTransitionIndexToSymbolMapReaders(long pTransitionIndex){
  final int columnCount=Unsafe.getUnsafe().getInt(pTransitionIndex + 4);
  final long index=pTransitionIndex + 8;
  final long stateAddress=index + columnCount * 8;
  if (columnCount > this.columnCount) {
    symbolMapReaders.setPos(columnCount);
  }
  Unsafe.getUnsafe().setMemory(stateAddress,columnCount,(byte)0);
  for (int i=0; i < columnCount; i++) {
    if (Unsafe.getUnsafe().getByte(stateAddress + i) == -1) {
      continue;
    }
    Unsafe.getUnsafe().putByte(stateAddress + i,(byte)-1);
    int copyFrom=Unsafe.getUnsafe().getInt(index + i * 8);
    if (copyFrom == i + 1) {
      continue;
    }
    SymbolMapReader tmp;
    if (copyFrom > 0) {
      tmp=symbolMapReaders.getAndSetQuick(copyFrom - 1,null);
      tmp=symbolMapReaders.getAndSetQuick(i,tmp);
      int copyTo=Unsafe.getUnsafe().getInt(index + i * 8 + 4);
      while (copyTo > 0) {
        if (Unsafe.getUnsafe().getByte(stateAddress + copyTo - 1) == -1) {
          break;
        }
        Unsafe.getUnsafe().putByte(stateAddress + copyTo - 1,(byte)-1);
        tmp=symbolMapReaders.getAndSetQuick(copyTo - 1,tmp);
        copyTo=Unsafe.getUnsafe().getInt(index + (copyTo - 1) * 8 + 4);
      }
      Misc.free(tmp);
    }
 else {
      RecordColumnMetadata m=metadata.getColumnQuick(i);
      if (m.getType() == ColumnType.SYMBOL) {
        SymbolMapReaderImpl reader=new SymbolMapReaderImpl(configuration,path,m.getName(),0);
        tmp=symbolMapReaders.getAndSetQuick(i,reader);
        Misc.free(tmp);
      }
 else {
        Misc.free(symbolMapReaders.getAndSetQuick(i,null));
      }
    }
  }
  if (columnCount < this.columnCount) {
    for (int i=columnCount; i < this.columnCount; i++) {
      Misc.free(symbolMapReaders.getQuick(i));
    }
    symbolMapReaders.setPos(columnCount);
  }
}