summaryrefslogtreecommitdiff
path: root/src/udev/collect/collect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev/collect/collect.c')
-rw-r--r--src/udev/collect/collect.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/udev/collect/collect.c b/src/udev/collect/collect.c
index f95ee23b75..1346f27f91 100644
--- a/src/udev/collect/collect.c
+++ b/src/udev/collect/collect.c
@@ -442,19 +442,19 @@ int main(int argc, char **argv)
if (debug)
fprintf(stderr, "ID %s: not in database\n", argv[i]);
- him = malloc(sizeof (struct _mate));
+ him = new(struct _mate, 1);
if (!him) {
ret = ENOMEM;
goto out;
}
- him->name = malloc(strlen(argv[i]) + 1);
+ him->name = strdup(argv[i]);
if (!him->name) {
+ free(him);
ret = ENOMEM;
goto out;
}
- strcpy(him->name, argv[i]);
him->state = STATE_NONE;
udev_list_node_append(&him->node, &bunch);
} else {