I see in C++ there are multiple ways to allocate and free data and I understand that when you call malloc you should call free and when you use the
If you are using C++, try to use new/delete instead of malloc/calloc as they are operators. For malloc/calloc, you need to include another header. Don't mix two different languages in the same code. Their work is similar in every manner, both allocates memory dynamically from heap segment in hash table.