|
|
1abbee |
From 68550741351080ab8458d54a6900b2b6ea1ef511 Mon Sep 17 00:00:00 2001
|
|
|
1abbee |
From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org>
|
|
|
1abbee |
Date: Sat, 9 May 2015 22:14:09 -0300
|
|
|
1abbee |
Subject: [PATCH] sd-bus: fix memory leak in test-bus-chat
|
|
|
1abbee |
|
|
|
1abbee |
Building with address sanitizer enabled on GCC 5.1.x a memory leak
|
|
|
1abbee |
is reported because we never close the bus, fix it by using
|
|
|
1abbee |
cleanup variable attribute.
|
|
|
1abbee |
|
|
|
1abbee |
Cherry-picked from: 2f50a2d55bf0a8b5959a6864ae1b39e7e9e0ce08
|
|
|
1abbee |
Related: #1331667
|
|
|
1abbee |
---
|
|
|
1abbee |
src/libsystemd/sd-bus/test-bus-chat.c | 4 +---
|
|
|
1abbee |
1 file changed, 1 insertion(+), 3 deletions(-)
|
|
|
1abbee |
|
|
|
1abbee |
diff --git a/src/libsystemd/sd-bus/test-bus-chat.c b/src/libsystemd/sd-bus/test-bus-chat.c
|
|
Pablo Greco |
48fc63 |
index 8625ee6d89..a80aaaeefe 100644
|
|
|
1abbee |
--- a/src/libsystemd/sd-bus/test-bus-chat.c
|
|
|
1abbee |
+++ b/src/libsystemd/sd-bus/test-bus-chat.c
|
|
|
1abbee |
@@ -264,7 +264,7 @@ fail:
|
|
|
1abbee |
|
|
|
1abbee |
static void* client1(void*p) {
|
|
|
1abbee |
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
|
|
|
1abbee |
- sd_bus *bus = NULL;
|
|
|
1abbee |
+ _cleanup_bus_close_unref_ sd_bus *bus = NULL;
|
|
|
1abbee |
sd_bus_error error = SD_BUS_ERROR_NULL;
|
|
|
1abbee |
const char *hello;
|
|
|
1abbee |
int r;
|
|
|
1abbee |
@@ -347,8 +347,6 @@ finish:
|
|
|
1abbee |
else
|
|
|
1abbee |
sd_bus_send(bus, q, NULL);
|
|
|
1abbee |
|
|
|
1abbee |
- sd_bus_flush(bus);
|
|
|
1abbee |
- sd_bus_unref(bus);
|
|
|
1abbee |
}
|
|
|
1abbee |
|
|
|
1abbee |
sd_bus_error_free(&error);
|