Messages in this thread | | | From | David Howells <> | Subject | Re: [PATCH v2] KEYS: fix memory leaks when reading certificate | Date | Wed, 30 Mar 2022 16:37:14 +0100 |
| |
Denis Glazkov <d.glazkov@omp.ru> wrote:
> The `exit()` function usage produce possible memory leaks. This > patch removes the use of the `exit()` function and adds memory > free in case of a negative scenarios.
?
Barring a kernel bug, there should be no memory leaks from exit(). _exit() is the ultimate process cleanup tool. Calling free() won't necessarily return the memory allocated by malloc() to the kernel.
Unless you have a good reason to actually tear down everything, just print a message and call exit on error in little helpers like this.
David
| |