X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flogin%2Flogind-device.c;h=6537fa04bfcbd6685fa5132d28ca508aea81b591;hp=76c5a5c88f0a630fda94658f5c09a209a333f836;hb=cac2e345596b2743053c0285280b81794b3aaf10;hpb=9588bc32096fc8342bfd8b989689717186d7d86e diff --git a/src/login/logind-device.c b/src/login/logind-device.c index 76c5a5c88..6537fa04b 100644 --- a/src/login/logind-device.c +++ b/src/login/logind-device.c @@ -1,5 +1,3 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - /*** This file is part of systemd. @@ -19,11 +17,11 @@ along with systemd; If not, see . ***/ -#include #include -#include "util.h" +#include "alloc-util.h" #include "logind-device.h" +#include "util.h" Device* device_new(Manager *m, const char *sysfs, bool master) { Device *d; @@ -36,15 +34,12 @@ Device* device_new(Manager *m, const char *sysfs, bool master) { return NULL; d->sysfs = strdup(sysfs); - if (!d->sysfs) { - free(d); - return NULL; - } + if (!d->sysfs) + return mfree(d); if (hashmap_put(m->devices, d->sysfs, d) < 0) { free(d->sysfs); - free(d); - return NULL; + return mfree(d); } d->manager = m;