Same memory leak as before. I don't understand why we keep doing this kind of stuff in C if we could be using C++, where safe constructs for this kind of data structure stuff is built-in (it even has priority queues in its stdlib).