Almost all branches are safe, if they are dry. That is, not freshly cut or wet -- the sap in the branches could run out and definately foul the water. Most branches are very dry if they have been sitting outside for a year or so. It is probably also better if you don't use the part that sits right on the ground, from the mold and breakdown of the wood there. Otherwise, you just need to use a little common sense. Walnut trees excrete a chemical that kills off neighbor plants, so, I wouldn't use walnut wood just in case any of that toxin gets in the tank. You need to look up what kind of wood you are using before you plop it in.
Otherwise, the vast majority of wood is pretty safe. You have to think that fish wouldn't be too affected since wood falls in and gets washed into water all over the world.