check ptr before dereferencing it. Found by PVS-Studio
[freeradius.git] / src / lib / missing.c
index 22fea07..95b8c54 100644 (file)
@@ -321,10 +321,9 @@ HMAC_CTX *HMAC_CTX_new(void)
 {
        HMAC_CTX *ctx;
        ctx = OPENSSL_malloc(sizeof(*ctx));
+       if (!ctx) return NULL;
+
        memset(ctx, 0, sizeof(*ctx));
-       if (ctx == NULL) {
-                return NULL;
-        }
         HMAC_CTX_init(ctx);
        return ctx;
 }