OSDN Git Service

obexd/server: Fix leaking drivers list
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 25 Sep 2013 08:31:08 +0000 (11:31 +0300)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 25 Sep 2013 08:40:12 +0000 (11:40 +0300)
The leak can be detected by using G_SLICE=always-malloc which will
produce the following trace using valgrind:
112 bytes in 7 blocks are definitely lost in loss record 123 of 167
   at 0x4A06409: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x3B03C4D89E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x3B03C6344D: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x3B03C647A5: g_slist_append (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x424DD3: obex_service_driver_list (service.c:76)
   by 0x42517F: obex_server_init (server.c:64)
   by 0x40D439: main (main.c:304)

obexd/src/server.c

index 36e6c7c..007c27e 100644 (file)
@@ -110,6 +110,7 @@ void obex_server_exit(void)
                struct obex_server *server = l->data;
 
                server->transport->stop(server->transport_data);
+               g_slist_free(server->drivers);
                g_free(server);
        }