Program: 55930
Project: 55930
Buggy source:
private void processEnvelopeWithBuffer(final TransferEnvelope transferEnvelope,final TransferEnvelopeReceiverList receiverList,final boolean freeSourceBuffer) throws IOException, InterruptedException {
  if (!freeSourceBuffer) {
    final List<ChannelID> localReceivers=receiverList.getLocalReceivers();
    if (localReceivers.size() != 1) {
      throw new IOException("String_Node_Str");
    }
    final ChannelID localReceiver=localReceivers.get(0);
    final ChannelContext cc=this.registeredChannels.get(localReceiver);
    if (cc == null) {
      throw new IOException("String_Node_Str" + localReceiver);
    }
    if (!cc.isInputChannel()) {
      throw new IOException("String_Node_Str" + localReceiver + "String_Node_Str");
    }
    cc.queueTransferEnvelope(transferEnvelope);
    return;
  }
  final Buffer srcBuffer=transferEnvelope.getBuffer();
  if (receiverList.hasLocalReceivers()) {
    final List<ChannelID> localReceivers=receiverList.getLocalReceivers();
    for (    final ChannelID localReceiver : localReceivers) {
      final ChannelContext cc=this.registeredChannels.get(localReceiver);
      if (cc == null) {
        throw new IOException("String_Node_Str" + localReceiver);
      }
      if (!cc.isInputChannel()) {
        throw new IOException("String_Node_Str" + localReceiver + "String_Node_Str");
      }
      final InputChannelContext inputChannelContext=(InputChannelContext)cc;
      final Buffer destBuffer=inputChannelContext.requestEmptyBufferBlocking(srcBuffer.size());
      srcBuffer.copyToBuffer(destBuffer);
      final TransferEnvelope dup=transferEnvelope.duplicateWithoutBuffer();
      dup.setBuffer(destBuffer);
      inputChannelContext.queueTransferEnvelope(dup);
    }
  }
  if (receiverList.hasRemoteReceivers()) {
    final List<InetSocketAddress> remoteReceivers=receiverList.getRemoteReceivers();
    for (    final InetSocketAddress remoteReceiver : remoteReceivers) {
      this.networkConnectionManager.queueEnvelopeForTransfer(remoteReceiver,transferEnvelope.duplicate());
    }
  }
  srcBuffer.recycleBuffer();
}

Fixed version (ground truth):
private void processEnvelopeWithBuffer(final TransferEnvelope transferEnvelope,final TransferEnvelopeReceiverList receiverList,final boolean freeSourceBuffer) throws IOException, InterruptedException {
  if (!freeSourceBuffer) {
    final List<ChannelID> localReceivers=receiverList.getLocalReceivers();
    if (localReceivers.size() != 1) {
      throw new IOException("String_Node_Str");
    }
    final ChannelID localReceiver=localReceivers.get(0);
    final ChannelContext cc=this.registeredChannels.get(localReceiver);
    if (cc == null) {
      throw new IOException("String_Node_Str" + localReceiver);
    }
    if (!cc.isInputChannel()) {
      throw new IOException("String_Node_Str" + localReceiver + "String_Node_Str");
    }
    cc.queueTransferEnvelope(transferEnvelope);
    return;
  }
  final Buffer srcBuffer=transferEnvelope.getBuffer();
  if (receiverList.hasLocalReceivers()) {
    final List<ChannelID> localReceivers=receiverList.getLocalReceivers();
    for (    final ChannelID localReceiver : localReceivers) {
      final ChannelContext cc=this.registeredChannels.get(localReceiver);
      if (cc == null) {
        throw new IOException("String_Node_Str" + localReceiver);
      }
      if (!cc.isInputChannel()) {
        throw new IOException("String_Node_Str" + localReceiver + "String_Node_Str");
      }
      final InputChannelContext inputChannelContext=(InputChannelContext)cc;
      final Buffer destBuffer=inputChannelContext.requestEmptyBufferBlocking(srcBuffer.size(),1);
      srcBuffer.copyToBuffer(destBuffer);
      final TransferEnvelope dup=transferEnvelope.duplicateWithoutBuffer();
      dup.setBuffer(destBuffer);
      inputChannelContext.queueTransferEnvelope(dup);
    }
  }
  if (receiverList.hasRemoteReceivers()) {
    final List<InetSocketAddress> remoteReceivers=receiverList.getRemoteReceivers();
    for (    final InetSocketAddress remoteReceiver : remoteReceivers) {
      this.networkConnectionManager.queueEnvelopeForTransfer(remoteReceiver,transferEnvelope.duplicate());
    }
  }
  srcBuffer.recycleBuffer();
}