Skip to content

Commit 4f6631c

Browse files
evverxpoettering
authored andcommitted
sd-bus: free everything when bus_set_address_user fails (systemd#6552)
Fixes: ``` $ env -i valgrind --leak-check=full ./build/test-bus-chat ... ==7763== 1,888 (1,824 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 2 of 2 ==7763== at 0x4C2FA50: calloc (vg_replace_malloc.c:711) ==7763== by 0x4F8FF9A: sd_bus_new (sd-bus.c:175) ==7763== by 0x4F938BF: sd_bus_open_user (sd-bus.c:1138) ==7763== by 0x109ACD: server_init (test-bus-chat.c:70) ==7763== by 0x10BCF8: main (test-bus-chat.c:526) ==7763== ``` Closes systemd#6481
1 parent 5aece00 commit 4f6631c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ _public_ int sd_bus_open_user(sd_bus **ret) {
11411141

11421142
r = bus_set_address_user(b);
11431143
if (r < 0)
1144-
return r;
1144+
goto fail;
11451145

11461146
b->bus_client = true;
11471147
b->is_user = true;

0 commit comments

Comments
 (0)