From: Yu Watanabe Date: Mon, 27 Aug 2018 20:09:00 +0000 (+0900) Subject: dynamic-user: fix potential segfault X-Git-Tag: v240~791^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=288ca7af8c260619bf0aab675c55e2367eea5006;p=thirdparty%2Fsystemd.git dynamic-user: fix potential segfault --- diff --git a/src/core/dynamic-user.c b/src/core/dynamic-user.c index b3b197b494a..824ad06ab03 100644 --- a/src/core/dynamic-user.c +++ b/src/core/dynamic-user.c @@ -104,9 +104,11 @@ static int dynamic_user_acquire(Manager *m, const char *name, DynamicUser** ret) d = hashmap_get(m->dynamic_users, name); if (d) { - /* We already have a structure for the dynamic user, let's increase the ref count and reuse it */ - d->n_ref++; - *ret = d; + if (ret) { + /* We already have a structure for the dynamic user, let's increase the ref count and reuse it */ + d->n_ref++; + *ret = d; + } return 0; }