[PATCH xorg-gtest 2/2] XCloseDisplay(3) cannot handle NULL
Chase Douglas
chase.douglas at canonical.com
Fri May 25 07:47:49 PDT 2012
On 05/24/2012 06:57 PM, Peter Hutterer wrote:
> If the display failed to start, tearing it down with a NULL pointer causes a
> segfault.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> src/test.cpp | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/test.cpp b/src/test.cpp
> index c2df5a7..f016f06 100644
> --- a/src/test.cpp
> +++ b/src/test.cpp
> @@ -48,7 +48,8 @@ void xorg::testing::Test::SetUp() {
> }
>
> void xorg::testing::Test::TearDown() {
> - XCloseDisplay(d_->display);
> + if (d_->display)
> + XCloseDisplay(d_->display);
> d_->display = NULL;
> }
>
Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
And pushed.
Thanks!
More information about the xorg-devel
mailing list