Program: 55963
Project: 55963
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);
synchronized (this.registeredChannels) {
      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();
synchronized (this.registeredChannels) {
      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());
        final TransferEnvelope dup=transferEnvelope.duplicateWithoutBuffer();
        dup.setBuffer(destBuffer);
        inputChannelContext.queueTransferEnvelope(dup);
      }
    }
  }
  if (receiverList.hasRemoteReceivers()) {
    final List<InetSocketAddress> remoteReceivers=receiverList.getRemoteReceivers();
    for (int i=0; i < remoteReceivers.size(); ++i) {
      this.networkConnectionManager.queueEnvelopeForTransfer(remoteReceivers.get(i),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);
synchronized (this.registeredChannels) {
      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();
synchronized (this.registeredChannels) {
      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();
}