From bc9d73566494b0b0e5f45bfa4a9d315955876a16 Mon Sep 17 00:00:00 2001 From: Marc Hoersken Date: Mon, 15 Dec 2014 00:27:29 +0100 Subject: [PATCH] wincng.c: fix possible NULL pointer de-reference of bignum Fixes VS2012 code analysis warning C6011: dereferencing NULL pointer 'bignum'. libssh2 wincng.c 1567 --- src/wincng.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wincng.c b/src/wincng.c index db4cfdf..c8cb252 100644 --- a/src/wincng.c +++ b/src/wincng.c @@ -1563,9 +1563,11 @@ _libssh2_wincng_bignum_init(void) { _libssh2_bn *bignum; - bignum = malloc(sizeof(_libssh2_bn)); - bignum->bignum = NULL; - bignum->length = 0; + bignum = (_libssh2_bn *)malloc(sizeof(_libssh2_bn)); + if (bignum) { + bignum->bignum = NULL; + bignum->length = 0; + } return bignum; }