OK i've just got a quick question regarding pointers using new and delete operators. I tried to look it up in one book and several sites so far, but haven't really found an answer to this...

If i dynamically allocate memory using new, when my program exits will that memory be freed automatically by the operating system?

Perhaps an example would help...

Code:
int main() {
     int * num;
     num = new int;
     *num = 5;
     cout << "Value of number is: " << *num << endl;
     return 0;
}
(This isn't my real situation hehe)
Anyway, in the above, would the memory 'num' is pointing to be freed upon termination of my program? Or would it create a memory leak where no application can access that memory???