diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2003-10-23 08:27:16 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2003-10-23 08:27:16 +0000 |
commit | 522a040d2487b71fb38085654b2db82d0b9f7bf9 (patch) | |
tree | f01f58295fb76ea733729e52b5707e8c0e183b18 /crypto | |
parent | 4318dce616743be8d897c593e720b8c688307850 (diff) | |
download | src-522a040d2487b71fb38085654b2db82d0b9f7bf9.tar.gz src-522a040d2487b71fb38085654b2db82d0b9f7bf9.zip |
Plug a memory leak in the PAM child process. It is of no great consequence
as the process is short-lived, and the leak occurs very rarely and always
shortly before the process terminates.
MFC after: 3 days
Notes
Notes:
svn path=/head/; revision=121420
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/openssh/auth2-pam-freebsd.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/openssh/auth2-pam-freebsd.c b/crypto/openssh/auth2-pam-freebsd.c index a0dd88b76e69..e05898127111 100644 --- a/crypto/openssh/auth2-pam-freebsd.c +++ b/crypto/openssh/auth2-pam-freebsd.c @@ -132,6 +132,7 @@ pam_thread_conv(int n, if (n <= 0 || n > PAM_MAX_NUM_MSG) return (PAM_CONV_ERR); *resp = xmalloc(n * sizeof **resp); + memset(*resp, 0, n * sizeof **resp); buffer_init(&buffer); for (i = 0; i < n; ++i) { (*resp)[i].resp_retcode = 0; @@ -169,6 +170,13 @@ pam_thread_conv(int n, buffer_free(&buffer); return (PAM_SUCCESS); fail: + for (i = 0; i < n; ++i) { + if ((*resp)[i].resp != NULL) { + memset((*resp)[i].resp, 0, strlen((*resp)[i].resp)); + xfree((*resp)[i].resp); + } + } + memset(*resp, 0, n * sizeof **resp); xfree(*resp); *resp = NULL; buffer_free(&buffer); |