Safety valve, having: a valve body with a guide bore defining a longitudinal axis, a first opening formed at a bottom of the guide bore, and a second opening which is spaced apart from the bottom along the longitudinal axis and extends along a radial direction extending transversely to the longitudinal axis; a valve needle axially displaceably mounted in the guide bore of the valve body with a sealing surface facing the first opening; a compression spring device with a spring which is compressed by a preloading path and thereby preloads the valve needle along the longitudinal axis into a sealing position, in which the sealing surface of the valve needle seals the first opening; and a thermally activatable release unit, which has an extent along the longitudinal axis which is greater than the preloading path and which is designed to collapse when a release temperature is reached, wherein the compression spring device is supported against the release unit, characterized in that a locking device with a locking body which is mounted displaceably in a locking recess of the valve body extending in the radial direction and a spring which preloads the locking body in the radial direction towards the longitudinal axis; wherein the second opening of the valve body is arranged with respect to the longitudinal axis between the locking recess and the bottom; and wherein the valve needle has a locking groove which, in a sealing position of the valve needle, is positioned between the locking recess and the bottom of the valve body at a predetermined distance from the locking recess, and wherein the locking body engages in the locking groove in a locking position, in which it protrudes into the guide bore when the valve needle is pulled back by the predetermined distance from the first opening. a valve body with a guide bore defining a longitudinal axis, a first opening formed at a bottom of the guide bore, and a second opening which is spaced apart from the bottom along the longitudinal axis and extends along a radial direction extending transversely to the longitudinal axis; a valve needle axially displaceably mounted in the guide bore of the valve body with a sealing surface facing the first opening; a compression spring device with a spring which is compressed by a preloading path and thereby preloads the valve needle along the longitudinal axis into a sealing position, in which the sealing surface of the valve needle seals the first opening; and a thermally activatable release unit, which has an extent along the longitudinal axis which is greater than the preloading path and which is designed to collapse when a release temperature is reached, wherein the compression spring device is supported against the release unit, characterized in that a locking device with a locking body which is mounted displaceably in a locking recess of the valve body extending in the radial direction and a spring which preloads the locking body in the radial direction towards the longitudinal axis; wherein the second opening of the valve body is arranged with respect to the longitudinal axis between the locking recess and the bottom; and wherein the valve needle has a locking groove which, in a sealing position of the valve needle, is positioned between the locking recess and the bottom of the valve body at a predetermined distance from the locking recess, and wherein the locking body engages in the locking groove in a locking position, in which it protrudes into the guide bore when the valve needle is pulled back by the predetermined distance from the first opening.