crypto/x509v3/v3_utl.c:200: error: MEMORY_LEAK
  memory dynamically allocated by call to `BN_new()` at line 182, column 10 is not reachable after line 200, column 15.
Showing all 34 steps of the trace


crypto/x509v3/v3_utl.c:172:1: start of procedure s2i_ASN1_INTEGER()
170.   }
171.   
172. > ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, char *value)
173.   {
174.       BIGNUM *bn = NULL;

crypto/x509v3/v3_utl.c:174:5: 
172.   ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, char *value)
173.   {
174. >     BIGNUM *bn = NULL;
175.       ASN1_INTEGER *aint;
176.       int isneg, ishex;

crypto/x509v3/v3_utl.c:178:9: Taking false branch
176.       int isneg, ishex;
177.       int ret;
178.       if (value == NULL) {
               ^
179.           X509V3err(X509V3_F_S2I_ASN1_INTEGER, X509V3_R_INVALID_NULL_VALUE);
180.           return NULL;

crypto/x509v3/v3_utl.c:182:5: 
180.           return NULL;
181.       }
182. >     bn = BN_new();
183.       if (bn == NULL) {
184.           X509V3err(X509V3_F_S2I_ASN1_INTEGER, ERR_R_MALLOC_FAILURE);

crypto/bn/bn_lib.c:276:1: start of procedure BN_new()
  274.   }
  275.   
  276. > BIGNUM *BN_new(void)
  277.   {
  278.       BIGNUM *ret;

crypto/bn/bn_lib.c:280:9: 
  278.       BIGNUM *ret;
  279.   
  280. >     if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
  281.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  282.           return (NULL);

crypto/mem.c:156:1: start of procedure CRYPTO_zalloc()
    154.   }
    155.   
    156. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:158:5: 
    156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158. >     void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
      117.   }
      118.   
      119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121.       void *ret = NULL;

crypto/mem.c:121:5: 
      119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121. >     void *ret = NULL;
      122.   
      123.       if (num <= 0)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (num <= 0)
                     ^
      124.           return NULL;
      125.   

crypto/mem.c:126:5: 
      124.           return NULL;
      125.   
      126. >     allow_customize = 0;
      127.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      128.       if (call_malloc_debug) {

crypto/mem.c:136:5: 
      134.       }
      135.   #else
      136. >     (void)file;
      137.       (void)line;
      138.       ret = malloc(num);

crypto/mem.c:137:5: 
      135.   #else
      136.       (void)file;
      137. >     (void)line;
      138.       ret = malloc(num);
      139.   #endif

crypto/mem.c:138:5: 
      136.       (void)file;
      137.       (void)line;
      138. >     ret = malloc(num);
      139.   #endif
      140.   

crypto/mem.c:153:5: 
      151.   #endif
      152.   
      153. >     return ret;
      154.   }
      155.   

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
      152.   
      153.       return ret;
      154. > }
      155.   
      156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:160:9: Taking true branch
    158.       void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)
                   ^
    161.           memset(ret, 0, num);
    162.       return ret;

crypto/mem.c:161:9: 
    159.   
    160.       if (ret != NULL)
    161. >         memset(ret, 0, num);
    162.       return ret;
    163.   }

crypto/mem.c:162:5: 
    160.       if (ret != NULL)
    161.           memset(ret, 0, num);
    162. >     return ret;
    163.   }
    164.   

crypto/mem.c:163:1: return from a call to CRYPTO_zalloc
    161.           memset(ret, 0, num);
    162.       return ret;
    163. > }
    164.   
    165.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/bn/bn_lib.c:280:9: Taking false branch
  278.       BIGNUM *ret;
  279.   
  280.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
                 ^
  281.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  282.           return (NULL);

crypto/bn/bn_lib.c:284:5: 
  282.           return (NULL);
  283.       }
  284. >     ret->flags = BN_FLG_MALLOCED;
  285.       bn_check_top(ret);
  286.       return (ret);

crypto/bn/bn_lib.c:286:5: 
  284.       ret->flags = BN_FLG_MALLOCED;
  285.       bn_check_top(ret);
  286. >     return (ret);
  287.   }
  288.   

crypto/bn/bn_lib.c:287:1: return from a call to BN_new
  285.       bn_check_top(ret);
  286.       return (ret);
  287. > }
  288.   
  289.    BIGNUM *BN_secure_new(void)

crypto/x509v3/v3_utl.c:183:9: Taking false branch
181.       }
182.       bn = BN_new();
183.       if (bn == NULL) {
               ^
184.           X509V3err(X509V3_F_S2I_ASN1_INTEGER, ERR_R_MALLOC_FAILURE);
185.           return NULL;

crypto/x509v3/v3_utl.c:187:9: Taking false branch
185.           return NULL;
186.       }
187.       if (value[0] == '-') {
               ^
188.           value++;
189.           isneg = 1;

crypto/x509v3/v3_utl.c:191:9: 
189.           isneg = 1;
190.       } else
191. >         isneg = 0;
192.   
193.       if (value[0] == '0' && ((value[1] == 'x') || (value[1] == 'X'))) {

crypto/x509v3/v3_utl.c:193:9: Taking true branch
191.           isneg = 0;
192.   
193.       if (value[0] == '0' && ((value[1] == 'x') || (value[1] == 'X'))) {
               ^
194.           value += 2;
195.           ishex = 1;

crypto/x509v3/v3_utl.c:193:30: Taking true branch
191.           isneg = 0;
192.   
193.       if (value[0] == '0' && ((value[1] == 'x') || (value[1] == 'X'))) {
                                    ^
194.           value += 2;
195.           ishex = 1;

crypto/x509v3/v3_utl.c:194:9: 
192.   
193.       if (value[0] == '0' && ((value[1] == 'x') || (value[1] == 'X'))) {
194. >         value += 2;
195.           ishex = 1;
196.       } else

crypto/x509v3/v3_utl.c:195:9: 
193.       if (value[0] == '0' && ((value[1] == 'x') || (value[1] == 'X'))) {
194.           value += 2;
195. >         ishex = 1;
196.       } else
197.           ishex = 0;

crypto/x509v3/v3_utl.c:199:9: Taking true branch
197.           ishex = 0;
198.   
199.       if (ishex)
               ^
200.           ret = BN_hex2bn(&bn, value);
201.       else

crypto/x509v3/v3_utl.c:200:9: Skipping BN_hex2bn(): empty list of specs
198.   
199.       if (ishex)
200.           ret = BN_hex2bn(&bn, value);
               ^
201.       else
202.           ret = BN_dec2bn(&bn, value);

ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, char *value)
{
    BIGNUM *bn = NULL;
    ASN1_INTEGER *aint;
    int isneg, ishex;
    int ret;
    if (value == NULL) {
        X509V3err(X509V3_F_S2I_ASN1_INTEGER, X509V3_R_INVALID_NULL_VALUE);
        return NULL;
    }
    bn = BN_new();
    if (bn == NULL) {
        X509V3err(X509V3_F_S2I_ASN1_INTEGER, ERR_R_MALLOC_FAILURE);
        return NULL;
    }
    if (value[0] == '-') {
        value++;
        isneg = 1;
    } else
        isneg = 0;
    if (value[0] == '0' && ((value[1] == 'x') || (value[1] == 'X'))) {
        value += 2;
        ishex = 1;
    } else
        ishex = 0;
    if (ishex)
        ret = BN_hex2bn(&bn, value);
    else
        ret = BN_dec2bn(&bn, value);
    if (!ret || value[ret]) {
        BN_free(bn);
        X509V3err(X509V3_F_S2I_ASN1_INTEGER, X509V3_R_BN_DEC2BN_ERROR);
        return NULL;
    }
    if (isneg && BN_is_zero(bn))
        isneg = 0;
    aint = BN_to_ASN1_INTEGER(bn, NULL);
    BN_free(bn);
    if (!aint) {
        X509V3err(X509V3_F_S2I_ASN1_INTEGER,
                  X509V3_R_BN_TO_ASN1_INTEGER_ERROR);
        return NULL;
    }
    if (isneg)
        aint->type |= V_ASN1_NEG;
    return aint;
}
["ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, char *value)\n{\n    BIGNUM *bn = NULL;\n    ASN1_INTEGER *aint;\n    int isneg, ishex;\n    int ret;\n    if (value == NULL) {\n        X509V3err(X509V3_F_S2I_ASN1_INTEGER, X509V3_R_INVALID_NULL_VALUE);\n        return NULL;\n    }\n    bn = BN_new();\n    if (bn == NULL) {\n        X509V3err(X509V3_F_S2I_ASN1_INTEGER, ERR_R_MALLOC_FAILURE);\n        return NULL;\n    }\n    if (value[0] == '-') {\n        value++;\n        isneg = 1;\n    } else\n        isneg = 0;\n    if (value[0] == '0' && ((value[1] == 'x') || (value[1] == 'X'))) {\n        value += 2;\n        ishex = 1;\n    } else\n        ishex = 0;\n    if (ishex)\n        ret = BN_hex2bn(&bn, value);\n    else\n        ret = BN_dec2bn(&bn, value);\n    if (!ret || value[ret]) {\n        BN_free(bn);\n        X509V3err(X509V3_F_S2I_ASN1_INTEGER, X509V3_R_BN_DEC2BN_ERROR);\n        return NULL;\n    }\n    if (isneg && BN_is_zero(bn))\n        isneg = 0;\n    aint = BN_to_ASN1_INTEGER(bn, NULL);\n    BN_free(bn);\n    if (!aint) {\n        X509V3err(X509V3_F_S2I_ASN1_INTEGER,\n                  X509V3_R_BN_TO_ASN1_INTEGER_ERROR);\n        return NULL;\n    }\n    if (isneg)\n        aint->type |= V_ASN1_NEG;\n    return aint;\n}", 'BIGNUM *BN_new(void)\n{\n    BIGNUM *ret;\n    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {\n        BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);\n        return (NULL);\n    }\n    ret->flags = BN_FLG_MALLOCED;\n    bn_check_top(ret);\n    return (ret);\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (num <= 0)\n        return NULL;\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)file;\n    (void)line;\n    ret = malloc(num);\n#endif\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}']