This looks overly complicated and only works because you use calloc which initializes everything to 0 (i.e. strncpy won't write the terminating zero because you do not specify the full size of the buffer). I would suggest you use a plain malloc + strcpy here since you know that the buffer is big enough to fit the string. Or even better, simply change _objectName to Common::String (in case that's possible).