I would be very surprised if they let you write code for them without a contract in place. IANAL, but I believe that technically code you write in your own time is your IP unless you've signed a contract saying otherwise.
My point was more that I've seen lots of problems attributed to the last engineer out of the door in the places I've worked. If liability isn't taken care of (sometimes there is a separate contract for liability & scope of work apart from the attribution of IP), and you're doing work to "do the right thing" then it may well be a case of "no good deed goes unpunished".