dynamic-user: fix potential segfault

This commit is contained in:
Yu Watanabe 2018-08-28 05:09:00 +09:00
parent 8301aa0bf1
commit 288ca7af8c
1 changed files with 5 additions and 3 deletions

View File

@ -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;
}