You want dead, hard wood, nothing from an evergreen tree or plants that have been sprayed with pesticides. Freshly fallen wood could have saps or other things that can leech into your water. Ideally you want something that's been dead for years. If you find something that seems safe, you need to wash and boil it for several hours to kill anything that might be living in it and to remove some of the tannins. I would also remove any bark.
If you don't want to risk it, look into manzanita wood, it's pretty twiglike and aquarium-safe.