Дана 24/09/22 07:59PM, Страхиња Радић написа:
> Of course, that would cause a memory leak if the memory was assigned to 
> a variable, like this:
> 
>       char* tmp = malloc(13);
> 
> otherwise, like this:
> 
>       malloc(13);
> 
> the result is discarded and a warning is printed if the program is 
> compiled by GCC.

Correction/clarification: even if the result is discarded, this still
causes the leak, just the pointer to the allocated memory is not
assigned to a variable. This is easily verifiable by using
ktrace(1)/kdump(1).

Reply via email to