crypto/hmac/hm_ameth.c:117: error: MEMORY_LEAK
  memory dynamically allocated by call to `ASN1_OCTET_STRING_new()` at line 109, column 10 is not reachable after line 117, column 5.
Showing all 65 steps of the trace


crypto/hmac/hm_ameth.c:105:1: start of procedure old_hmac_decode()
103.    */
104.   
105. > static int old_hmac_decode(EVP_PKEY *pkey,
106.                              const unsigned char **pder, int derlen)
107.   {

crypto/hmac/hm_ameth.c:109:5: 
107.   {
108.       ASN1_OCTET_STRING *os;
109. >     os = ASN1_OCTET_STRING_new();
110.       if (os == NULL || !ASN1_OCTET_STRING_set(os, *pder, derlen))
111.           goto err;

crypto/asn1/tasn_typ.c:76:1: start of procedure ASN1_OCTET_STRING_new()
  74.   }
  75.   
  76. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  77.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  78.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)

crypto/asn1/asn1_lib.c:348:1: start of procedure ASN1_STRING_type_new()
    346.   }
    347.   
    348. > ASN1_STRING *ASN1_STRING_type_new(int type)
    349.   {
    350.       ASN1_STRING *ret;

crypto/asn1/asn1_lib.c:352:5: 
    350.       ASN1_STRING *ret;
    351.   
    352. >     ret = OPENSSL_zalloc(sizeof(*ret));
    353.       if (ret == NULL) {
    354.           ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);

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/asn1/asn1_lib.c:353:9: Taking false branch
    351.   
    352.       ret = OPENSSL_zalloc(sizeof(*ret));
    353.       if (ret == NULL) {
                   ^
    354.           ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
    355.           return (NULL);

crypto/asn1/asn1_lib.c:357:5: 
    355.           return (NULL);
    356.       }
    357. >     ret->type = type;
    358.       return (ret);
    359.   }

crypto/asn1/asn1_lib.c:358:5: 
    356.       }
    357.       ret->type = type;
    358. >     return (ret);
    359.   }
    360.   

crypto/asn1/asn1_lib.c:359:1: return from a call to ASN1_STRING_type_new
    357.       ret->type = type;
    358.       return (ret);
    359. > }
    360.   
    361.   void ASN1_STRING_free(ASN1_STRING *a)

crypto/asn1/tasn_typ.c:76:1: return from a call to ASN1_OCTET_STRING_new
  74.   }
  75.   
  76. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  77.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  78.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)

crypto/hmac/hm_ameth.c:110:9: Taking false branch
108.       ASN1_OCTET_STRING *os;
109.       os = ASN1_OCTET_STRING_new();
110.       if (os == NULL || !ASN1_OCTET_STRING_set(os, *pder, derlen))
               ^
111.           goto err;
112.       if (!EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os))

crypto/hmac/hm_ameth.c:110:24: 
108.       ASN1_OCTET_STRING *os;
109.       os = ASN1_OCTET_STRING_new();
110. >     if (os == NULL || !ASN1_OCTET_STRING_set(os, *pder, derlen))
111.           goto err;
112.       if (!EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os))

crypto/asn1/a_octet.c:73:1: start of procedure ASN1_OCTET_STRING_set()
  71.   }
  72.   
  73. > int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d,
  74.                             int len)
  75.   {

crypto/asn1/a_octet.c:76:5: 
  74.                             int len)
  75.   {
  76. >     return ASN1_STRING_set(x, d, len);
  77.   }

crypto/asn1/asn1_lib.c:307:1: start of procedure ASN1_STRING_set()
    305.   }
    306.   
    307. > int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
    308.   {
    309.       unsigned char *c;

crypto/asn1/asn1_lib.c:310:5: 
    308.   {
    309.       unsigned char *c;
    310. >     const char *data = _data;
    311.   
    312.       if (len < 0) {

crypto/asn1/asn1_lib.c:312:9: Taking true branch
    310.       const char *data = _data;
    311.   
    312.       if (len < 0) {
                   ^
    313.           if (data == NULL)
    314.               return (0);

crypto/asn1/asn1_lib.c:313:13: Taking false branch
    311.   
    312.       if (len < 0) {
    313.           if (data == NULL)
                       ^
    314.               return (0);
    315.           else

crypto/asn1/asn1_lib.c:316:13: 
    314.               return (0);
    315.           else
    316. >             len = strlen(data);
    317.       }
    318.       if ((str->length < len) || (str->data == NULL)) {

crypto/asn1/asn1_lib.c:318:10: Taking false branch
    316.               len = strlen(data);
    317.       }
    318.       if ((str->length < len) || (str->data == NULL)) {
                    ^
    319.           c = str->data;
    320.           str->data = OPENSSL_realloc(c, len + 1);

crypto/asn1/asn1_lib.c:318:33: Taking false branch
    316.               len = strlen(data);
    317.       }
    318.       if ((str->length < len) || (str->data == NULL)) {
                                           ^
    319.           c = str->data;
    320.           str->data = OPENSSL_realloc(c, len + 1);

crypto/asn1/asn1_lib.c:327:5: 
    325.           }
    326.       }
    327. >     str->length = len;
    328.       if (data != NULL) {
    329.           memcpy(str->data, data, len);

crypto/asn1/asn1_lib.c:328:9: Taking true branch
    326.       }
    327.       str->length = len;
    328.       if (data != NULL) {
                   ^
    329.           memcpy(str->data, data, len);
    330.           /* an allowance for strings :-) */

crypto/asn1/asn1_lib.c:329:9: 
    327.       str->length = len;
    328.       if (data != NULL) {
    329. >         memcpy(str->data, data, len);
    330.           /* an allowance for strings :-) */
    331.           str->data[len] = '\0';

crypto/asn1/asn1_lib.c:331:9: 
    329.           memcpy(str->data, data, len);
    330.           /* an allowance for strings :-) */
    331. >         str->data[len] = '\0';
    332.       }
    333.       return (1);

crypto/asn1/asn1_lib.c:333:5: 
    331.           str->data[len] = '\0';
    332.       }
    333. >     return (1);
    334.   }
    335.   

crypto/asn1/asn1_lib.c:334:1: return from a call to ASN1_STRING_set
    332.       }
    333.       return (1);
    334. > }
    335.   
    336.   void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len)

crypto/asn1/a_octet.c:77:1: return from a call to ASN1_OCTET_STRING_set
  75.   {
  76.       return ASN1_STRING_set(x, d, len);
  77. > }

crypto/hmac/hm_ameth.c:110:24: Taking false branch
108.       ASN1_OCTET_STRING *os;
109.       os = ASN1_OCTET_STRING_new();
110.       if (os == NULL || !ASN1_OCTET_STRING_set(os, *pder, derlen))
                              ^
111.           goto err;
112.       if (!EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os))

crypto/hmac/hm_ameth.c:112:10: 
110.       if (os == NULL || !ASN1_OCTET_STRING_set(os, *pder, derlen))
111.           goto err;
112. >     if (!EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os))
113.           goto err;
114.       return 1;

crypto/evp/p_lib.c:270:1: start of procedure EVP_PKEY_assign()
  268.   }
  269.   
  270. > int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key)
  271.   {
  272.       if (pkey == NULL || !EVP_PKEY_set_type(pkey, type))

crypto/evp/p_lib.c:272:9: Taking false branch
  270.   int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key)
  271.   {
  272.       if (pkey == NULL || !EVP_PKEY_set_type(pkey, type))
                 ^
  273.           return 0;
  274.       pkey->pkey.ptr = key;

crypto/evp/p_lib.c:272:26: 
  270.   int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key)
  271.   {
  272. >     if (pkey == NULL || !EVP_PKEY_set_type(pkey, type))
  273.           return 0;
  274.       pkey->pkey.ptr = key;

crypto/evp/p_lib.c:260:1: start of procedure EVP_PKEY_set_type()
    258.   }
    259.   
    260. > int EVP_PKEY_set_type(EVP_PKEY *pkey, int type)
    261.   {
    262.       return pkey_set_type(pkey, type, NULL, -1);

crypto/evp/p_lib.c:262:5: Skipping pkey_set_type(): empty list of specs
    260.   int EVP_PKEY_set_type(EVP_PKEY *pkey, int type)
    261.   {
    262.       return pkey_set_type(pkey, type, NULL, -1);
               ^
    263.   }
    264.   

crypto/evp/p_lib.c:263:1: return from a call to EVP_PKEY_set_type
    261.   {
    262.       return pkey_set_type(pkey, type, NULL, -1);
    263. > }
    264.   
    265.   int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len)

crypto/evp/p_lib.c:272:26: Taking true branch
  270.   int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key)
  271.   {
  272.       if (pkey == NULL || !EVP_PKEY_set_type(pkey, type))
                                  ^
  273.           return 0;
  274.       pkey->pkey.ptr = key;

crypto/evp/p_lib.c:273:9: 
  271.   {
  272.       if (pkey == NULL || !EVP_PKEY_set_type(pkey, type))
  273. >         return 0;
  274.       pkey->pkey.ptr = key;
  275.       return (key != NULL);

crypto/evp/p_lib.c:276:1: return from a call to EVP_PKEY_assign
  274.       pkey->pkey.ptr = key;
  275.       return (key != NULL);
  276. > }
  277.   
  278.   void *EVP_PKEY_get0(const EVP_PKEY *pkey)

crypto/hmac/hm_ameth.c:112:10: Taking true branch
110.       if (os == NULL || !ASN1_OCTET_STRING_set(os, *pder, derlen))
111.           goto err;
112.       if (!EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os))
                ^
113.           goto err;
114.       return 1;

crypto/hmac/hm_ameth.c:116:2: 
114.       return 1;
115.   
116. >  err:
117.       ASN1_OCTET_STRING_free(os);
118.       return 0;

crypto/hmac/hm_ameth.c:117:5: 
115.   
116.    err:
117. >     ASN1_OCTET_STRING_free(os);
118.       return 0;
119.   }

crypto/asn1/tasn_typ.c:76:1: start of procedure ASN1_OCTET_STRING_free()
  74.   }
  75.   
  76. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  77.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  78.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)

crypto/asn1/asn1_lib.c:361:1: start of procedure ASN1_STRING_free()
    359.   }
    360.   
    361. > void ASN1_STRING_free(ASN1_STRING *a)
    362.   {
    363.       if (a == NULL)

crypto/asn1/asn1_lib.c:363:9: Taking false branch
    361.   void ASN1_STRING_free(ASN1_STRING *a)
    362.   {
    363.       if (a == NULL)
                   ^
    364.           return;
    365.       if (!(a->flags & ASN1_STRING_FLAG_NDEF))

crypto/asn1/asn1_lib.c:365:11: Taking false branch
    363.       if (a == NULL)
    364.           return;
    365.       if (!(a->flags & ASN1_STRING_FLAG_NDEF))
                     ^
    366.           OPENSSL_free(a->data);
    367.       if (!(a->flags & ASN1_STRING_FLAG_EMBED))

crypto/asn1/asn1_lib.c:367:11: Taking false branch
    365.       if (!(a->flags & ASN1_STRING_FLAG_NDEF))
    366.           OPENSSL_free(a->data);
    367.       if (!(a->flags & ASN1_STRING_FLAG_EMBED))
                     ^
    368.           OPENSSL_free(a);
    369.   }

crypto/asn1/asn1_lib.c:367:5: 
    365.       if (!(a->flags & ASN1_STRING_FLAG_NDEF))
    366.           OPENSSL_free(a->data);
    367. >     if (!(a->flags & ASN1_STRING_FLAG_EMBED))
    368.           OPENSSL_free(a);
    369.   }

crypto/asn1/asn1_lib.c:369:1: return from a call to ASN1_STRING_free
    367.       if (!(a->flags & ASN1_STRING_FLAG_EMBED))
    368.           OPENSSL_free(a);
    369. > }
    370.   
    371.   void ASN1_STRING_clear_free(ASN1_STRING *a)

crypto/asn1/tasn_typ.c:76:1: return from a call to ASN1_OCTET_STRING_free
  74.   }
  75.   
  76. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  77.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  78.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)

static int old_hmac_decode(EVP_PKEY *pkey,
                           const unsigned char **pder, int derlen)
{
    ASN1_OCTET_STRING *os;
    os = ASN1_OCTET_STRING_new();
    if (os == NULL || !ASN1_OCTET_STRING_set(os, *pder, derlen))
        goto err;
    if (!EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os))
        goto err;
    return 1;
 err:
    ASN1_OCTET_STRING_free(os);
    return 0;
}
['static int old_hmac_decode(EVP_PKEY *pkey,\n                           const unsigned char **pder, int derlen)\n{\n    ASN1_OCTET_STRING *os;\n    os = ASN1_OCTET_STRING_new();\n    if (os == NULL || !ASN1_OCTET_STRING_set(os, *pder, derlen))\n        goto err;\n    if (!EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os))\n        goto err;\n    return 1;\n err:\n    ASN1_OCTET_STRING_free(os);\n    return 0;\n}', 'IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)', 'ASN1_STRING *ASN1_STRING_type_new(int type)\n{\n    ASN1_STRING *ret;\n    ret = OPENSSL_zalloc(sizeof(*ret));\n    if (ret == NULL) {\n        ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);\n        return (NULL);\n    }\n    ret->type = type;\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}', 'int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d,\n                          int len)\n{\n    return ASN1_STRING_set(x, d, len);\n}', "int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)\n{\n    unsigned char *c;\n    const char *data = _data;\n    if (len < 0) {\n        if (data == NULL)\n            return (0);\n        else\n            len = strlen(data);\n    }\n    if ((str->length < len) || (str->data == NULL)) {\n        c = str->data;\n        str->data = OPENSSL_realloc(c, len + 1);\n        if (str->data == NULL) {\n            ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);\n            str->data = c;\n            return (0);\n        }\n    }\n    str->length = len;\n    if (data != NULL) {\n        memcpy(str->data, data, len);\n        str->data[len] = '\\0';\n    }\n    return (1);\n}", 'int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key)\n{\n    if (pkey == NULL || !EVP_PKEY_set_type(pkey, type))\n        return 0;\n    pkey->pkey.ptr = key;\n    return (key != NULL);\n}', 'int EVP_PKEY_set_type(EVP_PKEY *pkey, int type)\n{\n    return pkey_set_type(pkey, type, NULL, -1);\n}', 'void ASN1_STRING_free(ASN1_STRING *a)\n{\n    if (a == NULL)\n        return;\n    if (!(a->flags & ASN1_STRING_FLAG_NDEF))\n        OPENSSL_free(a->data);\n    if (!(a->flags & ASN1_STRING_FLAG_EMBED))\n        OPENSSL_free(a);\n}']