Running xhost through valgrind (with no arguments to xhost) produced "still reachable: 27,720 bytes in 25 blocks." This patch reduces this to "still reachable: 15 bytes in 1 blocks."
Signed-off-by: Jeff Smith <[email protected]> --- xhost.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/xhost.c b/xhost.c index 2b4784a..f0fba73 100644 --- a/xhost.c +++ b/xhost.c @@ -278,14 +278,16 @@ main(int argc, char *argv[]) } else printf("\n"); } - free(list); - endhostent(); + XFree(list); } + endhostent(); + XCloseDisplay(dpy); exit(0); } if (argc == 2 && !strcmp(argv[1], "-help")) { fprintf(stderr, "usage: %s [[+-]hostname ...]\n", argv[0]); + XCloseDisplay(dpy); exit(1); } @@ -364,6 +366,7 @@ change_host(Display *dpy, char *name, Bool add) namelen = strlen(name); if ((lname = (char *)malloc(namelen+1)) == NULL) { fprintf (stderr, "%s: malloc bombed in change_host\n", ProgramName); + XCloseDisplay (dpy); exit (1); } for (i = 0; i < namelen; i++) { -- 1.6.0.6 __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
