Disconnect you Mac from the internet ( Turn off Wifi ) and reboot.
Open Safari and Reset Safari
In Safari Preferences set Safari to open with a blank page ( if desired )
Turn Wifi On
Browse freely and never visit dodgy websites again
Hope that all goes well w/ McBie's excellent advice - now, you might want to better protect yourself during web browsing and have a tool or two for adware removal - first, check the Safe Mac website for an in depth look @ malware including those affecting web browsers; also, download Adware Medic, which is also discussed in the first link.
In addition, you might want to obtain several Safari extensions, i.e. Adblock Plus and Ghostery are often recommended here - good luck! Dave
Jayar, I got the sequence wrong, my apologies.
Reboot the Mac.
Turn Wifi OFF ( or otherwise disconnect from the internet )
Set Safari Preferences so that Safari opens with a new , Blank window
Stay away from dodgy sites
If that is not helping, please let us know what kind of malware you are seeing.