From: Yu Watanabe Date: Fri, 11 May 2018 09:12:12 +0000 (+0900) Subject: dbus-unit: check userdata before obtaining data X-Git-Tag: v239~261^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d1d854713740e4d077758d3d7f5b717af8af3565;p=thirdparty%2Fsystemd.git dbus-unit: check userdata before obtaining data --- diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 68d7afc1a3e..34024885008 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -99,7 +99,7 @@ static int property_get_dependencies( void *userdata, sd_bus_error *error) { - Hashmap *h = *(Hashmap**) userdata; + Hashmap **h = userdata; Iterator j; Unit *u; void *v; @@ -107,12 +107,13 @@ static int property_get_dependencies( assert(bus); assert(reply); + assert(h); r = sd_bus_message_open_container(reply, 'a', "s"); if (r < 0) return r; - HASHMAP_FOREACH_KEY(v, u, h, j) { + HASHMAP_FOREACH_KEY(v, u, *h, j) { r = sd_bus_message_append(reply, "s", u->id); if (r < 0) return r; @@ -146,7 +147,7 @@ static int property_get_requires_mounts_for( void *userdata, sd_bus_error *error) { - Hashmap *h = *(Hashmap**) userdata; + Hashmap **h = userdata; const char *p; Iterator j; void *v; @@ -154,12 +155,13 @@ static int property_get_requires_mounts_for( assert(bus); assert(reply); + assert(h); r = sd_bus_message_open_container(reply, 'a', "s"); if (r < 0) return r; - HASHMAP_FOREACH_KEY(v, p, h, j) { + HASHMAP_FOREACH_KEY(v, p, *h, j) { r = sd_bus_message_append(reply, "s", p); if (r < 0) return r;