summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas M. DuBuisson <tommd@muse.dev>2020-11-24 14:52:31 -0800
committerDmitry V. Levin <ldv@altlinux.org>2020-11-24 22:56:49 +0000
commit225f17470eed9f44282f435ad1ed64c94d9a2ddf (patch)
tree6ee56a9c750a51b3e2e01520f10c5b32202aa74d
parentb09a562fd0f7e8357c05038774782621db89ea10 (diff)
downloadlinux-pam-git-1.5.1.tar.gz
pam_unix: fix memory leak on error pathv1.5.1
* modules/pam_unix/bigcrypt.c (bigcrypt) [HAVE_CRYPT_R]: Do not leak cdata if crypt_r() fails.
-rw-r--r--modules/pam_unix/bigcrypt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/pam_unix/bigcrypt.c b/modules/pam_unix/bigcrypt.c
index e08e4098..31be2f7b 100644
--- a/modules/pam_unix/bigcrypt.c
+++ b/modules/pam_unix/bigcrypt.c
@@ -111,6 +111,9 @@ char *bigcrypt(const char *key, const char *salt)
#endif
if (tmp_ptr == NULL) {
free(dec_c2_cryptbuf);
+#ifdef HAVE_CRYPT_R
+ free(cdata);
+#endif
return NULL;
}
/* and place in the static area */
@@ -137,6 +140,9 @@ char *bigcrypt(const char *key, const char *salt)
if (tmp_ptr == NULL) {
_pam_overwrite(dec_c2_cryptbuf);
free(dec_c2_cryptbuf);
+#ifdef HAVE_CRYPT_R
+ free(cdata);
+#endif
return NULL;
}