summaryrefslogtreecommitdiffstats
path: root/src/crypt_zip.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-04-27 22:06:37 +0200
committerBram Moolenaar <Bram@vim.org>2019-04-27 22:06:37 +0200
commit6ee9658774942f7448af700fc04df0335796a3db (patch)
tree87f99c37e22f07e73e244da78686c7e59a8457f1 /src/crypt_zip.c
parent00aa069db8132851a91cfc5ca7f58ef945c75c73 (diff)
patch 8.1.1219: not checking for NULL return from alloc()v8.1.1219
Problem: Not checking for NULL return from alloc(). Solution: Add checks. (Martin Kunev, closes #4303, closes #4174)
Diffstat (limited to 'src/crypt_zip.c')
-rw-r--r--src/crypt_zip.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/crypt_zip.c b/src/crypt_zip.c
index 864812e18d..25b7962a3b 100644
--- a/src/crypt_zip.c
+++ b/src/crypt_zip.c
@@ -78,7 +78,7 @@ make_crc_tab(void)
/*
* Initialize for encryption/decryption.
*/
- void
+ int
crypt_zip_init(
cryptstate_T *state,
char_u *key,
@@ -91,6 +91,8 @@ crypt_zip_init(
zip_state_T *zs;
zs = (zip_state_T *)alloc(sizeof(zip_state_T));
+ if (zs == NULL)
+ return FAIL;
state->method_state = zs;
make_crc_tab();
@@ -99,6 +101,8 @@ crypt_zip_init(
zs->keys[2] = 878082192L;
for (p = key; *p != NUL; ++p)
UPDATE_KEYS_ZIP(zs->keys, (int)*p);
+
+ return OK;
}
/*