server: destroy the socket event source on display destroy
authorPekka Paalanen <ppaalanen@gmail.com>
Thu, 22 Dec 2011 14:52:37 +0000 (16:52 +0200)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 22 Dec 2011 15:40:39 +0000 (10:40 -0500)
commitaad1e190588a0edc5a39a9feba534e7a6d4532d4
tree8275666d52e265c983dcf5ba1a8def5cb6af308a
parent1f58d155da09f66dc1eaaafafddae3312e71704f
server: destroy the socket event source on display destroy

On wl_display_add_socket(), the listening socket fd is added to the
event loop. However, wl_event_source object is not stored and hence
cannot be freed, resulting in a minor leak.

Store wl_event_source pointer in struct wl_socket so we can track it,
and destroy it on wl_display_destroy(). The event loop itself must be
destroyed after destroying the event sources linked to it.

Fixes a Valgrind reported memory leak.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
src/wayland-server.c