Program: 46633
Project: 46633
Buggy source:
private void saveFrames(RenderedImage scanImage,String fnameTmpl){
  RenderedOp frame=null;
  RenderedOp rotated=null;
  for (int n=1; n < perfY.size() - 2; n++) {
    String fname=String.format(fnameTmpl,(Integer)n);
    System.out.println("String_Node_Str" + fname);
    int startY=(perfY.get(n - 1) + perfY.get(n)) >> 1;
    int startX=perfX.get(n - 1);
    System.out.println("String_Node_Str" + startX + "String_Node_Str"+ startY);
    int w=Math.min(frameWidth,scanImage.getWidth() - startX);
    AffineTransform xform=getFrameXform(n);
    if (frame == null) {
      rotated=AffineDescriptor.create(scanImage,xform,Interpolation.getInstance(Interpolation.INTERP_BICUBIC),null,null);
      frame=CropDescriptor.create(rotated,(float)0,(float)0,(float)w,(float)frameHeight,null);
    }
 else {
      rotated.setParameter(xform,0);
    }
    ImageWriter writer=null;
    Iterator iter=ImageIO.getImageWritersByFormatName("String_Node_Str");
    if (iter.hasNext()) {
      writer=(ImageWriter)iter.next();
    }
    if (writer != null) {
      ImageOutputStream ios=null;
      try {
        ios=ImageIO.createImageOutputStream(new File(fname));
        writer.setOutput(ios);
        ImageWriteParam param=writer.getDefaultWriteParam();
        PlanarImage rendering=frame.getNewRendering();
        writer.write(null,new IIOImage(rendering,null,null),param);
        ios.flush();
        rendering.dispose();
      }
 catch (      IOException ex) {
        Logger.getLogger(SplitScan.class.getName()).log(Level.SEVERE,null,ex);
      }
 finally {
        if (ios != null) {
          try {
            ios.close();
          }
 catch (          IOException e) {
            System.err.println("String_Node_Str");
          }
        }
        writer.dispose();
      }
    }
    if (debug) {
      String debugFname=String.format("String_Node_Str",(Integer)n);
      BufferedImage debugLayer=new BufferedImage(frame.getWidth(),frame.getHeight(),BufferedImage.TYPE_INT_RGB);
      for (int row=0; row < frame.getHeight(); row++) {
        debugLayer.getRaster().setPixel(perfBorderX[startY + row],row,new int[]{255,255,255});
      }
      try {
        ImageIO.write(debugLayer,"String_Node_Str",new File(debugFname));
      }
 catch (      IOException ex) {
        Logger.getLogger(SplitScan.class.getName()).log(Level.SEVERE,null,ex);
      }
    }
    frame.dispose();
    rotated.dispose();
    System.gc();
    System.gc();
  }
}

Fixed version (ground truth):
private void saveFrames(RenderedImage scanImage,String fnameTmpl){
  RenderedOp frame=null;
  RenderedOp rotated=null;
  int frameNum=1;
  for (int n=0; n < perfY.size(); n++) {
    String fname=String.format(fnameTmpl,(Integer)frameNum);
    System.out.println("String_Node_Str" + fname);
    int startX=perfX.get(n);
    int w=Math.min(frameWidth,scanImage.getWidth() - startX);
    AffineTransform xform=getFrameXform(n);
    try {
      if (frame == null) {
        rotated=AffineDescriptor.create(scanImage,xform,Interpolation.getInstance(Interpolation.INTERP_BICUBIC),null,null);
        frame=CropDescriptor.create(rotated,(float)0,(float)0,(float)w,(float)frameHeight,null);
      }
 else {
        rotated.setParameter(xform,0);
      }
      ImageWriter writer=null;
      Iterator iter=ImageIO.getImageWritersByFormatName("String_Node_Str");
      if (iter.hasNext()) {
        writer=(ImageWriter)iter.next();
      }
      if (writer != null) {
        ImageOutputStream ios=null;
        try {
          ios=ImageIO.createImageOutputStream(new File(fname));
          writer.setOutput(ios);
          ImageWriteParam param=writer.getDefaultWriteParam();
          PlanarImage rendering=frame.getNewRendering();
          writer.write(null,new IIOImage(rendering,null,null),param);
          ios.flush();
          rendering.dispose();
        }
 catch (        IOException ex) {
          Logger.getLogger(SplitScan.class.getName()).log(Level.SEVERE,null,ex);
        }
 finally {
          if (ios != null) {
            try {
              ios.close();
            }
 catch (            IOException e) {
              System.err.println("String_Node_Str");
            }
          }
          writer.dispose();
        }
      }
      frame.dispose();
      rotated.dispose();
      System.gc();
      System.gc();
      frameNum++;
    }
 catch (    Exception e) {
      System.err.println("String_Node_Str" + frameNum + "String_Node_Str"+ e.getMessage());
    }
  }
}