summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sysif.c4
-rw-r--r--tests/018/crypt.tl2
2 files changed, 5 insertions, 1 deletions
diff --git a/sysif.c b/sysif.c
index 5af269d5..00354a10 100644
--- a/sysif.c
+++ b/sysif.c
@@ -2083,11 +2083,15 @@ static val crypt_wrap(val wkey, val wsalt)
if (hash != 0) {
val ret = string_utf8(hash);
+#if HAVE_CRYPT_R
free(cd);
+#endif
return ret;
}
+#if HAVE_CRYPT_R
free(cd);
+#endif
uw_ethrowf(error_s, lit("crypt failed: ~d/~s"), num(errno),
errno_to_str(errno), nao);
diff --git a/tests/018/crypt.tl b/tests/018/crypt.tl
index 55a897af..3652b6e1 100644
--- a/tests/018/crypt.tl
+++ b/tests/018/crypt.tl
@@ -2,12 +2,12 @@
(mtest
(crypt nil nil) :error
- (crypt "a" "b") :error
(crypt "a" "bc") "bcshMw5X24ayQ"
(crypt "a" "bcd") "bcshMw5X24ayQ")
(if (eq :linux (os-symbol))
(mtest
+ (crypt "a" "b") :error
(crypt "a" "$0$") :error
(crypt "a" "$9$") :error
(crypt "a" "$1$") "$1$$Ij31LCAysPM23KuPlm1wA/"