The timeout value can be set with I2C_MasterSetTimeoutValue().
But first, you need to ensure that timeout is enabled on CFG register. Then you will chose if the timeout will be event caused or by SCL line. With the timeout, you can choose the action to recover the bus. If the slave is holding the bus, then the master can recover by manually sending SCL pulses until SDA is released.
BR,
Omar