One of the problems we met is solved by commit 44fdac69eb864125b4d02af0c650ce735dcf7aa8. Also there are many uses of shm/pkg_str_dup() where the src is not NULL checked right before doing the dup (probably NULL check is done on higher levels but some mistakes might happen).
I think you are right with setting dst->s=NULL only if src->s == NULL. Updated the pull request to respect this.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/401#issuecomment-157720978