Copyright law and famous characters reference

Is it possible in a novel to write something like “I won’t be your ‘Malfoy’ just because I hate you” or even mentioning a copyright protected character is a violation?

If you mean in terms of selling(because if its like fanfiction or just a free novel, then its protected from a copyright strike. Fair use): i think it depends on how many times you make the references and what’s the company who owns the right to that character/objects etc.(because some companies would just let it go, others on the other hand not so much.)
But this is just me guessing but I think you should be fine as you don’t keep putting references on references.
But this might help you more than me: Lol


Thanks @Alexis :slightly_smiling_face: