Do not leak globals and listeners.

From 3fa2ad7dec42f85795449f33b2a4c9461aa4924d Mon Sep 17 00:00:00 2001
From: Laszlo Agocs <laszlo.p.agocs@nokia.com>
Date: Tue, 14 Jun 2011 11:35:28 +0200
Subject: [PATCH] Do not leak globals and listeners.
This commit is contained in:
Laszlo Agocs 2011-06-14 11:41:54 +02:00 committed by Kristian Høgsberg
parent a2db57517b
commit 9c36ea776b
2 changed files with 16 additions and 3 deletions

View File

@ -413,8 +413,18 @@ wl_display_connect(const char *name)
WL_EXPORT void
wl_display_destroy(struct wl_display *display)
{
struct wl_global *global, *gnext;
struct wl_global_listener *listener, *lnext;
wl_connection_destroy(display->connection);
wl_hash_table_destroy(display->objects);
wl_list_for_each_safe(global, gnext,
&display->global_list, link)
free(global);
wl_list_for_each_safe(listener, lnext,
&display->global_listener_list, link)
free(listener);
close(display->fd);
free(display);
}

View File

@ -617,10 +617,10 @@ WL_EXPORT void
wl_display_destroy(struct wl_display *display)
{
struct wl_socket *s, *next;
struct wl_global *global, *gnext;
wl_event_loop_destroy(display->loop);
wl_hash_table_destroy(display->objects);
wl_event_loop_destroy(display->loop);
wl_hash_table_destroy(display->objects);
wl_list_for_each_safe(s, next, &display->socket_list, link) {
close(s->fd);
unlink(s->addr.sun_path);
@ -629,6 +629,9 @@ wl_display_destroy(struct wl_display *display)
free(s);
}
wl_list_for_each_safe(global, gnext, &display->global_list, link)
free(global);
free(display);
}