[sr-dev] [kamailio] core: NULL checks for ut.h (#401)
Daniel-Constantin Mierla
notifications at github.com
Wed Nov 18 12:09:05 CET 2015
Are these for safety reasons or have you found specific cases in other parts of code affected by not having this checks?
One comment I have is about the str dup functions, when the new check on len==0 results in setting dst s to NULL. Specs for malloc(0) are not very strict, saying that it can return a valid pointer for free(). However, the free(0) should not be done. With kamailio memory managers, pkg/shm malloc 0 returns a pointer of size(void*).
I think would be ok to set dst s to null if src s is null, but if src len is 0 and src s is not null, maybe is better to allocate it...
These are some thoughts, perhaps a deeper review where these str dup functions are used should be done.
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/401#issuecomment-157680622
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20151118/7b475b89/attachment.html>
More information about the sr-dev
mailing list