X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=device.c;h=6de7d518c718cfc30496f7a5fb45f9824a25ad2e;hp=1b0b50fd4e796752826d79a278c4d322c7430919;hb=b866264a18095d5302443ab0a95560d973ba4b10;hpb=c18315a88da3864f29908ad299750f98e6160f42 diff --git a/device.c b/device.c index 1b0b50fd4..6de7d518c 100644 --- a/device.c +++ b/device.c @@ -186,8 +186,10 @@ static int device_process_new_device(Manager *m, struct udev_device *dev, bool u if (names) { FOREACH_WORD(w, l, names, state) { - if (!(e = strndup(w, l))) + if (!(e = strndup(w, l))) { + r = -ENOMEM; goto fail; + } r = unit_add_name(u, e); free(e); @@ -199,8 +201,10 @@ static int device_process_new_device(Manager *m, struct udev_device *dev, bool u if (wants) { FOREACH_WORD(w, l, wants, state) { - if (!(e = strndup(w, l))) + if (!(e = strndup(w, l))) { + r = -ENOMEM; goto fail; + } r = unit_add_dependency_by_name(u, UNIT_WANTS, e); free(e);