DNS leaks are a major problem of Tor. Tor doesn't provide a direct solution to that but there are still some ways to solve this problem. One is dns-proxy-tor which is a DNS server that constructs tor to map a domain to a virtual IP address and subsequently tor will treat the virtual IP address as an alias for the original domain name.
The other solution is a patch written by total information security which modifies tsocks to transparently implement Tor. With this patch tsocks uses SOCKS for name resolution which both prevents DNS leaks and enables direct access to .onion addresses for torified programmes. Without the patch one has to add mapaddress lines to his torrc to map domains to virtual IP addresses.
Yesterday I wrote a bug report about this to Gentoo bugzilla to add a tordns useflag to tsocks and devs have added it to portage. This is what I love about gentoo. You request a feature and if it's acceptable it'll be added before you wake up next day. :)