summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libcrypto.c6
-rw-r--r--src/libgcrypt.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/libcrypto.c b/src/libcrypto.c
index 84afbb09..479c8c18 100644
--- a/src/libcrypto.c
+++ b/src/libcrypto.c
@@ -250,7 +250,11 @@ void md5_final(unsigned char *md, MD5CTX c) {
}
ssh_mac_ctx ssh_mac_ctx_init(enum ssh_mac_e type){
- ssh_mac_ctx ctx=malloc(sizeof(struct ssh_mac_ctx_struct));
+ ssh_mac_ctx ctx = malloc(sizeof(struct ssh_mac_ctx_struct));
+ if (ctx == NULL) {
+ return NULL;
+ }
+
ctx->mac_type=type;
switch(type){
case SSH_MAC_SHA1:
diff --git a/src/libgcrypt.c b/src/libgcrypt.c
index 6151cfad..24d4a3c5 100644
--- a/src/libgcrypt.c
+++ b/src/libgcrypt.c
@@ -150,7 +150,11 @@ void md5_final(unsigned char *md, MD5CTX c) {
}
ssh_mac_ctx ssh_mac_ctx_init(enum ssh_mac_e type){
- ssh_mac_ctx ctx=malloc(sizeof(struct ssh_mac_ctx_struct));
+ ssh_mac_ctx ctx = malloc(sizeof(struct ssh_mac_ctx_struct));
+ if (ctx == NULL) {
+ return NULL;
+ }
+
ctx->mac_type=type;
switch(type){
case SSH_MAC_SHA1: