/* Add new node to the head of the list. */
if (op == add) {
- cur = emalloc(sizeof(struct list_member));
- cur->value = emalloc(len + 1);
- (void) memcpy(cur->value, val, len);
- cur->value[len] = '\0';
+ cur = ecalloc(1, sizeof(struct list_member));
+ cur->value = estrndup(val, len);
cur->next = def->sd_un.list;
def->sd_un.list = cur;
}