D-Bus: fix minor memory leak
When setting up a connection to the system D-Bus failed, the error message was leaked - occurred in testing, very unlikely in a real systen.
This commit is contained in:
parent
3bf8588aa0
commit
0a7939139d
|
@ -179,6 +179,8 @@ DBusConnectionPtr dbus_get_bus_connection(const char *busType,
|
|||
if(conn == NULL) {
|
||||
if (err) {
|
||||
err->set(error);
|
||||
} else {
|
||||
g_clear_error(&error);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -190,6 +192,8 @@ DBusConnectionPtr dbus_get_bus_connection(const char *busType,
|
|||
if(conn == NULL) {
|
||||
if (err) {
|
||||
err->set(error);
|
||||
} else {
|
||||
g_clear_error(&error);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -225,6 +229,8 @@ DBusConnectionPtr dbus_get_bus_connection(const std::string &address,
|
|||
false);
|
||||
if (!conn && err) {
|
||||
err->set(error);
|
||||
} else {
|
||||
g_clear_error(&error);
|
||||
}
|
||||
|
||||
return conn;
|
||||
|
@ -301,6 +307,8 @@ boost::shared_ptr<DBusServerCXX> DBusServerCXX::listen(const std::string &addres
|
|||
if (!server) {
|
||||
if (err) {
|
||||
err->set(error);
|
||||
} else {
|
||||
g_clear_error(&error);
|
||||
}
|
||||
return boost::shared_ptr<DBusServerCXX>();
|
||||
}
|
||||
|
|
|
@ -851,34 +851,6 @@
|
|||
obj:*libgnome-keyring.so*
|
||||
}
|
||||
|
||||
|
||||
# ==10804== 60 (16 direct, 44 indirect) bytes in 1 blocks are definitely lost in loss record 1,121 of 2,014
|
||||
# ==10804== at 0x4C27673: malloc (vg_replace_malloc.c:263)
|
||||
# ==10804== by 0x7FABC02: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3000.2)
|
||||
# ==10804== by 0x7FC0976: g_slice_alloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3000.2)
|
||||
# ==10804== by 0x7F9045F: g_error_copy (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3000.2)
|
||||
# ==10804== by 0x76700B1: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.3000.2)
|
||||
# ==10804== by 0x761465E: g_initable_new_valist (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.3000.2)
|
||||
# ==10804== by 0x7614748: g_initable_new (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.3000.2)
|
||||
# ==10804== by 0x766EB1E: g_dbus_connection_new_for_address_sync (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.3000.2)
|
||||
# ==10804== by 0x597E08: GDBusCXX::dbus_get_bus_connection(char const*, char const*, bool, GDBusCXX::DBusErrorCXX*) (gdbus-cxx-bridge.cpp:58)
|
||||
# ==10804== by 0x583CB8: SyncEvo::ConnmanClient::ConnmanClient(SyncEvo::Server&) (connman-client.cpp:30)
|
||||
# ==10804== by 0x541730: SyncEvo::Server::Server(_GMainLoop*, bool&, boost::shared_ptr<SyncEvo::Restart>&, GDBusCXX::DBusConnectionPtr const&, int) (server.cpp:239)
|
||||
# ==10804== by 0x52141B: main (main.cpp:113)
|
||||
# ==10804==
|
||||
{
|
||||
failed g_dbus_connection_new_for_address_sync
|
||||
Memcheck:Leak
|
||||
fun:malloc
|
||||
fun:g_malloc
|
||||
fun:g_slice_alloc
|
||||
fun:g_error_copy
|
||||
obj:*libgio*
|
||||
fun:g_initable_new_valist
|
||||
fun:g_initable_new
|
||||
fun:g_dbus_connection_new_for_address_sync
|
||||
}
|
||||
|
||||
# ==10804== 363 (120 direct, 243 indirect) bytes in 3 blocks are definitely lost in loss record 1,844 of 2,014
|
||||
# ==10804== at 0x4C27673: malloc (vg_replace_malloc.c:263)
|
||||
# ==10804== by 0x7FABC02: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3000.2)
|
||||
|
|
Loading…
Reference in New Issue