Gamma-ray bursts are believed to result from the coalescence of binary neutron stars. However, the standard proposals for conversion of the gravitational energy to thermal energy have difficulties. We show that if the merger of the two neutron stars results in a naked singularity, instead of a black hole, the ensuing quantum particle creation can provide the requisite thermal energy in a straightforward way. The back-reaction of the created particles can avoid the formation of the naked singularity predicted by the classical theory. Hence cosmic censorship holds in the quantum theory, even if it were to be violated in classical general relativity.