In case of brake failure, you should try to downshift the transmission, this will make the engine lose momentum and the car will slow down. And during this, slowly lift the handbrake and the car will eventually stop.