patch 9.2.0242: memory leak in check_for_cryptkey()
Commit:
https://github.com/vim/vim/commit/a4c0119786daba999c7f74be5ef2f3363e137af5
Author: Huihui Huang <[email protected]>
Date: Wed Mar 25 19:11:13 2026 +0000
patch 9.2.0242: memory leak in check_for_cryptkey()
Problem: memory leak in check_for_cryptkey()
Solution: Free cryptkey if it had been allocated
(Huihui Huang)
closes: #19821
Signed-off-by: Huihui Huang <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/fileio.c b/src/fileio.c
index 8917a7e29..e057b78ad 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3074,8 +3074,12 @@ check_for_cryptkey(
header_len = crypt_get_header_len(method);
if (*sizep < header_len)
+ {
// invalid header, buffer can't be encrypted
+ if (cryptkey != curbuf->b_p_key)
+ vim_free(cryptkey);
return NULL;
+ }
curbuf->b_cryptstate = crypt_create_from_header(
method, cryptkey, ptr);
diff --git a/src/version.c b/src/version.c
index 9bf8c8417..003ddcacb 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 242,
/**/
241,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1w5Th6-005jKw-1I%40256bit.org.