Do pointers cause memory leak?

As I’m trying to solve 2018 Silver US Open Multiplayer Moo I encountered an issue where parts of my visited array are randomly set to true, after specifically looping through the whole array and setting everything to false. I have no idea why it occurred, is it because I used a map<pair<int,int>, Node*> (Node is a struct defined by me) ?

Not sure if I should post my whole code here, it’s pretty long

if your code is too long, you might want to try a pasting service like paste of code or hatebin.

Check this post on how to paste code.
I’ll surely help if you paste your code.

Generally memory leaks shouldn’t be an issue for CP because the program terminates very soon, they’re an issue only when your code is running for a very long time(hours/days/weeks) and repeatedly leaking memory allocated on heap(production code which provides a service).