{
TR_NAME *to;
- if (to = malloc(sizeof(TR_NAME))) {
+ if (!from) {
+ return NULL;
+ }
+
+ if (NULL != (to = malloc(sizeof(TR_NAME)))) {
to->len = from->len;
- if (to->buf = malloc(to->len+1)) {
+ if (NULL != (to->buf = malloc(to->len+1))) {
strncpy(to->buf, from->buf, from->len);
to->buf[to->len] = 0; /* NULL terminate for debugging printf()s */
}
}
-
return to;
}