2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

Use ecalloc() when allocating structs.

This commit is contained in:
Todd C. Miller
2012-03-19 11:24:24 -04:00
parent dbbb48c45f
commit 55d1a1a79d
15 changed files with 81 additions and 94 deletions

View File

@@ -790,10 +790,8 @@ list_op(char *val, size_t len, struct sudo_defs_types *def, enum list_ops op)
/* 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;
}