Talking to hacks is a game with rules. Establish the ground rules before conversing on the topic in hand and you should not go wrong. Get clear beforehand what you want from the menu:
1) to be quoted by name
2) to be quoted anonymously
3) to talk on a background basis with no names or quotes.
If you want mixtures of the above, you have to be absolutely explicit when you are going on or off the record.
If you do not establish the ground rules before you speak, many journos will take that to mean that you are speaking on the record (i.e. name and quote). The more unscrupulous among them might not let you express your conditions at the end of the conversation, making it vital to get the rules right before you speak.