[PATCH xdriinfo] Resource cleanup fixes

Ian Romanick idr at freedesktop.org
Mon Mar 22 14:21:52 PDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jeff Smith wrote:
> Running xdriinfo through valgrind (with no arguments to xdriinfo) and
> screen 'not direct rendering capable' produced
> "still reachable: 41,240 bytes in 30 blocks."  This patch reduces this to
> "still reachable: 35 bytes in 2 blocks."
> 
> Signed-off-by: Jeff Smith <whydoubt at yahoo.com>

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> ---
>  xdriinfo.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/xdriinfo.c b/xdriinfo.c
> index 865b4bf..e2ca687 100644
> --- a/xdriinfo.c
> +++ b/xdriinfo.c
> @@ -132,6 +132,7 @@ int main (int argc, char *argv[]) {
>    /* final check on the screen number argument (if any)*/
>      if ((func == DRIVER || func == OPTIONS) && screenNum >= nScreens) {
>  	fprintf (stderr, "Screen number \"%d\" out of range.\n", screenNum);
> +	XCloseDisplay (dpy);
>  	return 1;
>      }
>  
> @@ -146,6 +147,7 @@ int main (int argc, char *argv[]) {
>  	  if (!name) {
>  	      fprintf (stderr, "Screen \"%d\" is not direct rendering capable.\n",
>  		       screenNum);
> +	      XCloseDisplay (dpy);
>  	      return 1;
>  	  }
>  	  printf ("%s", name);
> @@ -158,6 +160,7 @@ int main (int argc, char *argv[]) {
>  	  if (!name) {
>  	      fprintf (stderr, "Screen \"%d\" is not direct rendering capable.\n",
>  		       screenNum);
> +	      XCloseDisplay (dpy);
>  	      return 1;
>  	  }
>  	  options = (*GetDriverConfig) (name);
> @@ -165,6 +168,7 @@ int main (int argc, char *argv[]) {
>  	      fprintf (stderr,
>  		       "Driver \"%s\" is not installed or does not support configuration.\n",
>  		       name);
> +	      XCloseDisplay (dpy);
>  	      return 1;
>  	  }
>  	  printf ("%s", options);
> @@ -182,5 +186,6 @@ int main (int argc, char *argv[]) {
>  	}
>      }
>  
> +    XCloseDisplay (dpy);
>      return 0;
>  }

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkun328ACgkQX1gOwKyEAw8ezQCeOToIYvFtphfFdtEE9R1eFBLU
wpcAoIrSasBmGrUZ6CxPxYCficrfkRAV
=RaQV
-----END PGP SIGNATURE-----


More information about the xorg-devel mailing list