]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-bus: fix reference counter to be incremented
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 16 Apr 2022 22:05:07 +0000 (07:05 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 19 Apr 2022 08:58:08 +0000 (17:58 +0900)
Fixes #23097.

src/libsystemd/sd-bus/bus-track.c

index bc36673b839b718d1b733c887b32be05a6cc506b..891fd0c8999aad0bff5851d1beb6d9d824b97fd1 100644 (file)
@@ -191,12 +191,12 @@ _public_ int sd_bus_track_add_name(sd_bus_track *track, const char *name) {
         i = hashmap_get(track->names, name);
         if (i) {
                 if (track->recursive) {
-                        unsigned k = track->n_ref + 1;
+                        unsigned k = i->n_ref + 1;
 
-                        if (k < track->n_ref) /* Check for overflow */
+                        if (k < i->n_ref) /* Check for overflow */
                                 return -EOVERFLOW;
 
-                        track->n_ref = k;
+                        i->n_ref = k;
                 }
 
                 bus_track_remove_from_queue(track);