]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dbus-unit: check userdata before obtaining data
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 11 May 2018 09:12:12 +0000 (18:12 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 13 May 2018 03:21:15 +0000 (12:21 +0900)
src/core/dbus-unit.c

index 68d7afc1a3ee074d84bf69dae148340e8fd5b10a..3402488500805dd782d7a4cea71b62ca2e406425 100644 (file)
@@ -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;