diff options
author | des <des@FreeBSD.org> | 2003-10-23 08:27:16 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2003-10-23 08:27:16 +0000 |
commit | 365ce457b010b29a8841d527269ae156c8621dd7 (patch) | |
tree | f01f58295fb76ea733729e52b5707e8c0e183b18 /crypto | |
parent | 6cefc48da31e74a838ad2964537f869c408885aa (diff) | |
download | FreeBSD-src-365ce457b010b29a8841d527269ae156c8621dd7.zip FreeBSD-src-365ce457b010b29a8841d527269ae156c8621dd7.tar.gz |
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
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 a0dd88b..e058981 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); |