3 ms·
As for memory allocation, it's not really a good idea to allocate memory in a library and free it in another, is it? Ah, I guess I'll have to stop using strdup
by npsimons 14y ago
As for memory allocation, it's not really a good idea to allocate memory in a library and free it in another, is it?
Ah, I guess I'll have to stop using strdup() then.
- shin_lao 14y agostrdup(), part of the libc, allocates memory with a function from the libc (malloc), therefore you are allocating and freeing memory with functions within the same library. However, yes, for security reasons strdup should be avoided.