{
char *tmp;
- memcpy(&tmp, pair->value.xlat, sizeof(tmp));
+ memcpy(&tmp, &pair->value.xlat, sizeof(tmp));
free(tmp);
}
default:
/*
* Now copy the value
*/
- switch (vp->type)
- {
- case VT_XLAT:
- n->type = VT_NONE;
-
- if (pairmark_xlat(n, vp->value.xlat) < 0) {
- pairbasicfree(n);
- return NULL;
- }
- break;
- default:
- break;
+ if (vp->type == VT_XLAT) {
+ n->value.xlat = strdup(n->value.xlat);
}
n->da = dict_attr_copy(vp->da, TRUE);
if (!n->da) {
- free(n);
+ pairbasicfree(n);
return NULL;
}
return NULL;
}
- /*
- * Now copy the value
- */
- switch (n->type)
- {
- case VT_XLAT:
- n->type = VT_NONE;
-
- if (pairmark_xlat(n, vp->value.xlat) < 0) {
- pairbasicfree(n);
- return NULL;
- }
- break;
- default:
- break;
+ memcpy(n, vp, sizeof(*n));
+ n->da = da;
+
+ if (n->type == VT_XLAT) {
+ n->value.xlat = strdup(n->value.xlat);
}
- memcpy(&(n->data), &(vp->data), sizeof(n->data));
-
- n->length = vp->length;
-
if ((n->da->type == PW_TYPE_TLV) &&
(n->vp_tlv != NULL)) {
n->vp_tlv = malloc(n->length);