Re: malloc, free, strdup and kernel builds

2022-09-22 Thread Mark Stevens
Thanks you for taking the time to respond. I think I will look at providing kmm_strdup and submit a PR with the fix. It will probably be safer to do this and reduce the possibly of disturbing existing code with changes to the definition of free. Regards, Mark _ Blog

Re: malloc, free, strdup and kernel builds

2022-09-21 Thread Gregory Nutt
This does not seem like a technical issue but rather awkward usage/naming that is prone to misuse. Yes, free() should be called to release the memory allocated by strdup. But applications cannot use the kernel heap and, for reasons of protection, the kernel should not store anything in the use

malloc, free, strdup and kernel builds

2022-09-21 Thread Mark Stevens
So this post has been triggered by an issue I have just had using strdup in the OS components of a protected mode build. For clarity I will be using the term OS for the kernel part of the build and application/app for the user part of the build. The TLDR; is this design question: Do we expect