1
0
forked from aniani/vim

patch 8.1.1219: not checking for NULL return from alloc()

Problem:    Not checking for NULL return from alloc().
Solution:   Add checks. (Martin Kunev, closes #4303, closes #4174)
This commit is contained in:
Bram Moolenaar
2019-04-27 22:06:37 +02:00
parent 00aa069db8
commit 6ee9658774
14 changed files with 83 additions and 37 deletions

View File

@@ -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;
}
/*