You've got three types of allocation: static, automatic, and dynamic.
I was going to describe it in-depth, but I found this answer on SE that answers the question, and looks quite nice.
http://stackoverflow.com/questions/408670/stack-static-and-heap-in-c
Stack = automatic, Heap = dynamic.
Anyway, memory leaks only occur when you're using dynamic allocation. You've got an example of memory leakin Hydranix's code sample.
The problem with this approach is that the memory you can get is finite. If you don't free the memory, you create a memory leak - meaning you can't access this memory anymore. If your application runs long enough and leaks memory, you will run out of memory, and your program will crash.
Nowadays we don't have much problems with memory leaks, since we use smart pointers - see std::unique_ptr (which is used the most) and std::shared_ptr.
These pointers can be used with both C programs, wheer you use SomeFunction to allocate the memory, and FreeFunction to free memory, or C++, where you don't provide any function - destructor deallocates memory(or, preferably, using RAII and smart pointers, destructor doesn't do anything explicitly).