X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/167ff00352b6dd24b750f8e2c8138b09d128a9be..f7aa4b367eaf2c1e928f97263bcf4da74680aff3:/x11fwd.c diff --git a/x11fwd.c b/x11fwd.c index 5b4f76cd..895d8a99 100644 --- a/x11fwd.c +++ b/x11fwd.c @@ -171,6 +171,7 @@ struct X11Display *x11_setup_display(char *display, int authtype, Conf *conf) sk_addr_free(disp->addr); sfree(disp->hostname); sfree(disp->unixsocketpath); + sfree(disp); return NULL; /* FIXME: report an error */ } } @@ -264,10 +265,10 @@ void x11_free_display(struct X11Display *disp) sfree(disp->hostname); sfree(disp->unixsocketpath); if (disp->localauthdata) - memset(disp->localauthdata, 0, disp->localauthdatalen); + smemclr(disp->localauthdata, disp->localauthdatalen); sfree(disp->localauthdata); if (disp->remoteauthdata) - memset(disp->remoteauthdata, 0, disp->remoteauthdatalen); + smemclr(disp->remoteauthdata, disp->remoteauthdatalen); sfree(disp->remoteauthdata); sfree(disp->remoteauthprotoname); sfree(disp->remoteauthdatastring); @@ -343,7 +344,7 @@ void x11_get_auth_from_authfile(struct X11Display *disp, int len[4]; int family, protocol; int ideal_match = FALSE; - char *ourhostname = get_hostname(); + char *ourhostname; /* * Normally we should look for precisely the details specified in @@ -372,6 +373,8 @@ void x11_get_auth_from_authfile(struct X11Display *disp, if (!authfp) return; + ourhostname = get_hostname(); + /* Records in .Xauthority contain four strings of up to 64K each */ buf = snewn(65537 * 4, char); @@ -487,7 +490,7 @@ void x11_get_auth_from_authfile(struct X11Display *disp, done: fclose(authfp); - memset(buf, 0, 65537 * 4); + smemclr(buf, 65537 * 4); sfree(buf); sfree(ourhostname); }