Program: 10937
Project: 10937
Buggy source:
private void initHDAccount(DeterministicKey master,EncryptedData encryptedMnemonicSeed,EncryptedData encryptedHDSeed,boolean isSyncedComplete,HDAccountGenerationDelegate generationDelegate){
  double progress=0;
  if (generationDelegate != null) {
    generationDelegate.onHDAccountGenerationProgress(progress);
  }
  String firstAddress;
  ECKey k=new ECKey(mnemonicSeed,null);
  String address=k.toAddress();
  k.clearPrivateKey();
  DeterministicKey accountKey=getAccount(master);
  DeterministicKey internalKey=getChainRootKey(accountKey,AbstractHD.PathType.INTERNAL_ROOT_PATH);
  DeterministicKey externalKey=getChainRootKey(accountKey,AbstractHD.PathType.EXTERNAL_ROOT_PATH);
  DeterministicKey key=externalKey.deriveSoftened(0);
  firstAddress=key.toAddress();
  accountKey.wipe();
  master.wipe();
  progress+=GenerationPreStartProgress;
  if (generationDelegate != null) {
    generationDelegate.onHDAccountGenerationProgress(progress);
  }
  double itemProgress=(1.0 - GenerationPreStartProgress) / (LOOK_AHEAD_SIZE * 2);
  List<HDAccountAddress> externalAddresses=new ArrayList<HDAccountAddress>();
  List<HDAccountAddress> internalAddresses=new ArrayList<HDAccountAddress>();
  for (int i=0; i < LOOK_AHEAD_SIZE; i++) {
    byte[] subExternalPub=externalKey.deriveSoftened(i).getPubKey();
    HDAccountAddress externalAddress=new HDAccountAddress(subExternalPub,AbstractHD.PathType.EXTERNAL_ROOT_PATH,i,isSyncedComplete,hdSeedId);
    externalAddresses.add(externalAddress);
    progress+=itemProgress;
    if (generationDelegate != null) {
      generationDelegate.onHDAccountGenerationProgress(progress);
    }
    byte[] subInternalPub=internalKey.deriveSoftened(i).getPubKey();
    HDAccountAddress internalAddress=new HDAccountAddress(subInternalPub,AbstractHD.PathType.INTERNAL_ROOT_PATH,i,isSyncedComplete,hdSeedId);
    internalAddresses.add(internalAddress);
    progress+=itemProgress;
    if (generationDelegate != null) {
      generationDelegate.onHDAccountGenerationProgress(progress);
    }
  }
  wipeHDSeed();
  wipeMnemonicSeed();
  AbstractDb.hdAccountProvider.addAddress(externalAddresses);
  AbstractDb.hdAccountProvider.addAddress(internalAddresses);
  hdSeedId=AbstractDb.addressProvider.addHDAccount(encryptedMnemonicSeed.toEncryptedString(),encryptedHDSeed.toEncryptedString(),firstAddress,isFromXRandom,address,externalKey.getPubKeyExtended(),internalKey.getPubKeyExtended());
  internalKey.wipe();
  externalKey.wipe();
}

Fixed version (ground truth):
private void initHDAccount(DeterministicKey master,EncryptedData encryptedMnemonicSeed,EncryptedData encryptedHDSeed,boolean isSyncedComplete,HDAccountGenerationDelegate generationDelegate){
  double progress=0;
  if (generationDelegate != null) {
    generationDelegate.onHDAccountGenerationProgress(progress);
  }
  String firstAddress;
  ECKey k=new ECKey(mnemonicSeed,null);
  String address=k.toAddress();
  k.clearPrivateKey();
  DeterministicKey accountKey=getAccount(master);
  DeterministicKey internalKey=getChainRootKey(accountKey,AbstractHD.PathType.INTERNAL_ROOT_PATH);
  DeterministicKey externalKey=getChainRootKey(accountKey,AbstractHD.PathType.EXTERNAL_ROOT_PATH);
  DeterministicKey key=externalKey.deriveSoftened(0);
  firstAddress=key.toAddress();
  accountKey.wipe();
  master.wipe();
  progress+=GenerationPreStartProgress;
  if (generationDelegate != null) {
    generationDelegate.onHDAccountGenerationProgress(progress);
  }
  double itemProgress=(1.0 - GenerationPreStartProgress) / (LOOK_AHEAD_SIZE * 2);
  List<HDAccountAddress> externalAddresses=new ArrayList<HDAccountAddress>();
  List<HDAccountAddress> internalAddresses=new ArrayList<HDAccountAddress>();
  for (int i=0; i < LOOK_AHEAD_SIZE; i++) {
    byte[] subExternalPub=externalKey.deriveSoftened(i).getPubKey();
    HDAccountAddress externalAddress=new HDAccountAddress(subExternalPub,AbstractHD.PathType.EXTERNAL_ROOT_PATH,i,isSyncedComplete,hdSeedId);
    externalAddresses.add(externalAddress);
    progress+=itemProgress;
    if (generationDelegate != null) {
      generationDelegate.onHDAccountGenerationProgress(progress);
    }
    byte[] subInternalPub=internalKey.deriveSoftened(i).getPubKey();
    HDAccountAddress internalAddress=new HDAccountAddress(subInternalPub,AbstractHD.PathType.INTERNAL_ROOT_PATH,i,isSyncedComplete,hdSeedId);
    internalAddresses.add(internalAddress);
    progress+=itemProgress;
    if (generationDelegate != null) {
      generationDelegate.onHDAccountGenerationProgress(progress);
    }
  }
  wipeHDSeed();
  wipeMnemonicSeed();
  hdSeedId=AbstractDb.addressProvider.addHDAccount(encryptedMnemonicSeed.toEncryptedString(),encryptedHDSeed.toEncryptedString(),firstAddress,isFromXRandom,address,externalKey.getPubKeyExtended(),internalKey.getPubKeyExtended());
  for (  HDAccountAddress addr : externalAddresses) {
    addr.setHdAccountId(hdSeedId);
  }
  for (  HDAccountAddress addr : internalAddresses) {
    addr.setHdAccountId(hdSeedId);
  }
  AbstractDb.hdAccountProvider.addAddress(externalAddresses);
  AbstractDb.hdAccountProvider.addAddress(internalAddresses);
  internalKey.wipe();
  externalKey.wipe();
}