594167
From 4dcd6089addae3ef6b6c82e36b30b178a4261249 Mon Sep 17 00:00:00 2001
594167
From: Yu Watanabe <watanabe.yu+github@gmail.com>
594167
Date: Sun, 17 Apr 2022 07:05:07 +0900
594167
Subject: [PATCH] sd-bus: fix reference counter to be incremented
594167
594167
Fixes #23097.
594167
594167
(cherry picked from commit b21f237d996c8c18991a68e1204f060d07dc4745)
594167
594167
Related: #2087652
594167
---
594167
 src/libsystemd/sd-bus/bus-track.c | 6 +++---
594167
 1 file changed, 3 insertions(+), 3 deletions(-)
594167
594167
diff --git a/src/libsystemd/sd-bus/bus-track.c b/src/libsystemd/sd-bus/bus-track.c
594167
index bc36673b83..891fd0c899 100644
594167
--- a/src/libsystemd/sd-bus/bus-track.c
594167
+++ b/src/libsystemd/sd-bus/bus-track.c
594167
@@ -191,12 +191,12 @@ _public_ int sd_bus_track_add_name(sd_bus_track *track, const char *name) {
594167
         i = hashmap_get(track->names, name);
594167
         if (i) {
594167
                 if (track->recursive) {
594167
-                        unsigned k = track->n_ref + 1;
594167
+                        unsigned k = i->n_ref + 1;
594167
 
594167
-                        if (k < track->n_ref) /* Check for overflow */
594167
+                        if (k < i->n_ref) /* Check for overflow */
594167
                                 return -EOVERFLOW;
594167
 
594167
-                        track->n_ref = k;
594167
+                        i->n_ref = k;
594167
                 }
594167
 
594167
                 bus_track_remove_from_queue(track);