mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
tests: fix memory leak
We didn't free the struct client that we got from client_connect() Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
parent
3b7f9db591
commit
66bc781317
2 changed files with 14 additions and 10 deletions
|
|
@ -154,6 +154,14 @@ bind_seat(struct wl_client *client, void *data,
|
||||||
ci->data = res;
|
ci->data = res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
client_disconnect_nocheck(struct client *c)
|
||||||
|
{
|
||||||
|
wl_proxy_destroy((struct wl_proxy *) c->tc);
|
||||||
|
wl_display_disconnect(c->wl_display);
|
||||||
|
free(c);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
post_error_main(void)
|
post_error_main(void)
|
||||||
{
|
{
|
||||||
|
|
@ -170,8 +178,7 @@ post_error_main(void)
|
||||||
/* don't call client_disconnect(c), because then the test would be
|
/* don't call client_disconnect(c), because then the test would be
|
||||||
* aborted due to checks for error in this function */
|
* aborted due to checks for error in this function */
|
||||||
wl_proxy_destroy((struct wl_proxy *) seat);
|
wl_proxy_destroy((struct wl_proxy *) seat);
|
||||||
wl_proxy_destroy((struct wl_proxy *) c->tc);
|
client_disconnect_nocheck(c);
|
||||||
wl_display_disconnect(c->wl_display);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(post_error_to_one_client)
|
TEST(post_error_to_one_client)
|
||||||
|
|
@ -224,8 +231,7 @@ post_error_main3(void)
|
||||||
/* don't call client_disconnect(c), because then the test would be
|
/* don't call client_disconnect(c), because then the test would be
|
||||||
* aborted due to checks for error in this function */
|
* aborted due to checks for error in this function */
|
||||||
wl_proxy_destroy((struct wl_proxy *) seat);
|
wl_proxy_destroy((struct wl_proxy *) seat);
|
||||||
wl_proxy_destroy((struct wl_proxy *) c->tc);
|
client_disconnect_nocheck(c);
|
||||||
wl_display_disconnect(c->wl_display);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* all the testcases could be in one TEST, but splitting it
|
/* all the testcases could be in one TEST, but splitting it
|
||||||
|
|
@ -294,8 +300,7 @@ post_nomem_main(void)
|
||||||
assert(wl_display_get_error(c->wl_display) == ENOMEM);
|
assert(wl_display_get_error(c->wl_display) == ENOMEM);
|
||||||
|
|
||||||
wl_proxy_destroy((struct wl_proxy *) seat);
|
wl_proxy_destroy((struct wl_proxy *) seat);
|
||||||
wl_proxy_destroy((struct wl_proxy *) c->tc);
|
client_disconnect_nocheck(c);
|
||||||
wl_display_disconnect(c->wl_display);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(post_nomem_tst)
|
TEST(post_nomem_tst)
|
||||||
|
|
@ -428,8 +433,7 @@ threading_post_err(void)
|
||||||
alarm(3);
|
alarm(3);
|
||||||
pthread_join(thread, NULL);
|
pthread_join(thread, NULL);
|
||||||
|
|
||||||
wl_proxy_destroy((struct wl_proxy *) c->tc);
|
client_disconnect_nocheck(c);
|
||||||
wl_display_disconnect(c->wl_display);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(threading_errors_tst)
|
TEST(threading_errors_tst)
|
||||||
|
|
@ -580,8 +584,7 @@ threading_read_after_error(void)
|
||||||
alarm(3);
|
alarm(3);
|
||||||
pthread_join(thread, NULL);
|
pthread_join(thread, NULL);
|
||||||
|
|
||||||
wl_proxy_destroy((struct wl_proxy *) c->tc);
|
client_disconnect_nocheck(c);
|
||||||
wl_display_disconnect(c->wl_display);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(threading_read_after_error_tst)
|
TEST(threading_read_after_error_tst)
|
||||||
|
|
|
||||||
|
|
@ -452,6 +452,7 @@ client_disconnect(struct client *c)
|
||||||
|
|
||||||
wl_proxy_destroy((struct wl_proxy *) c->tc);
|
wl_proxy_destroy((struct wl_proxy *) c->tc);
|
||||||
wl_display_disconnect(c->wl_display);
|
wl_display_disconnect(c->wl_display);
|
||||||
|
free(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* num is number of clients that requests to stop display.
|
/* num is number of clients that requests to stop display.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue