A89: Re: Re: Memory Leaks
[Prev][Next][Index][Thread]
A89: Re: Re: Memory Leaks
> int *p = malloc(sizeof(*p) * 500);
> p = NULL;
>
> for example.
Also, if you call malloc() without a corresponding call to free(), you will
have a memory leak. The kernel UniversalOS does not automatically free
allocated memory at the end of the program, so you should always free the
memory yourself.
Btw, a question : is it allowed, in C, to call free() with a null pointer ?
I know that in c++, "delete 0" is allowed.
References: