summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-04-17 00:05:07 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-04-19 10:58:08 +0200
commitb21f237d996c8c18991a68e1204f060d07dc4745 (patch)
tree2c2daea0551c12eed6d5381ca88056b9c81d447d
parentmacro: check over flow in reference counter (diff)
downloadsystemd-b21f237d996c8c18991a68e1204f060d07dc4745.tar.xz
systemd-b21f237d996c8c18991a68e1204f060d07dc4745.zip
sd-bus: fix reference counter to be incremented
Fixes #23097.
Diffstat (limited to '')
-rw-r--r--src/libsystemd/sd-bus/bus-track.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsystemd/sd-bus/bus-track.c b/src/libsystemd/sd-bus/bus-track.c
index bc36673b83..891fd0c899 100644
--- a/src/libsystemd/sd-bus/bus-track.c
+++ b/src/libsystemd/sd-bus/bus-track.c
@@ -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);