chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
ef01fb1
)
sd-bus: fix memory leak in test-bus-chat
author
Cristian RodrÃguez
<crrodriguez@opensuse.org>
Sun, 10 May 2015 01:14:09 +0000
(22:14 -0300)
committer
Sven Eden
<yamakuzure@gmx.net>
Tue, 14 Mar 2017 07:23:32 +0000
(08:23 +0100)
Building with address sanitizer enabled on GCC 5.1.x a memory leak
is reported because we never close the bus, fix it by using
cleanup variable attribute.
src/libelogind/sd-bus/test-bus-chat.c
patch
|
blob
|
history
diff --git
a/src/libelogind/sd-bus/test-bus-chat.c
b/src/libelogind/sd-bus/test-bus-chat.c
index 99261fa4c914dc02785eac9104969f6b0ca18fb7..1e50dfc43323950eb2d189d20370be229ca88515 100644
(file)
--- a/
src/libelogind/sd-bus/test-bus-chat.c
+++ b/
src/libelogind/sd-bus/test-bus-chat.c
@@
-262,7
+262,7
@@
fail:
static void* client1(void*p) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
- sd_bus *bus = NULL;
+
_cleanup_bus_close_unref_
sd_bus *bus = NULL;
sd_bus_error error = SD_BUS_ERROR_NULL;
const char *hello;
int r;
@@
-345,8
+345,6
@@
finish:
else
sd_bus_send(bus, q, NULL);
- sd_bus_flush(bus);
- sd_bus_unref(bus);
}
sd_bus_error_free(&error);