If you don't make sure you own the code, then if you need to move companies or get support from a different firm, you can find yourself a bit stuck or in trouble if the first company goes down and someone else buys the rights.
On the other hand be very careful about General Public Licence or Creative Commons code creeping in, or people may have the right to copy your code and sometimes your images.