#vulnerable code 
                             protected XInputStream open(String path) throws Exception {
		//
		final RandomAccessFile file = new RandomAccessFile(path, "r");
		final XInputStream is = new XInputStreamImpl(new RamdomAccessFileInputStream(file));
		try {
			// Check binlog magic
			final byte[] magic = is.readBytes(MySQLConstants.BINLOG_MAGIC.length);
			if(!CodecUtils.equals(magic, MySQLConstants.BINLOG_MAGIC)) {
				throw new NestableRuntimeException("invalid binlog magic, file: " + path);
			}
			
			//
			if(this.startPosition > MySQLConstants.BINLOG_MAGIC.length) {
				is.skip(this.startPosition - MySQLConstants.BINLOG_MAGIC.length);
			}
			return is;
		} catch(Exception e) {
			IOUtils.closeQuietly(is);
			throw e;
		}
	} 
                            #location 18 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                             protected XInputStream open(String path) throws Exception {
		//
		final XInputStream is = new XInputStreamImpl(new FileInputStream(path));
		try {
			// Check binlog magic
			final byte[] magic = is.readBytes(MySQLConstants.BINLOG_MAGIC.length);
			if(!CodecUtils.equals(magic, MySQLConstants.BINLOG_MAGIC)) {
				throw new NestableRuntimeException("invalid binlog magic, file: " + path);
			}
			
			//
			if(this.startPosition > MySQLConstants.BINLOG_MAGIC.length) {
				is.skip(this.startPosition - MySQLConstants.BINLOG_MAGIC.length);
			}
			return is;
		} catch(Exception e) {
			IOUtils.closeQuietly(is);
			throw e;
		}
	}