You also need to consider bolting the 7812 to a large heat sink.
You haven't what current you what to supply but for the sake of argument
assume that it is 1A.
You have a 24V source and you are delivering 12V. This means that the
difference of 12V will be across the 7812. With 1A being supplied this
means that 7812 will be disipating 12W (12V x 1A) which will mostly be
turned into heat. This may not seem much compared with everyday domestic
appliances but for an electronics component it is a lot. Without an
effective way to get rid of this unwanted power (heat) the 7812 will cook
and probably fail.
Yes, That occurred to me after I posted. The 78xx series are thermal
protected ( IIRC) and also sometimes go into thermal oscillation.