crypto/ocsp/ocsp_ext.c:271: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_malloc()` at line 262, column 15 is not reachable after line 271, column 10.
Showing all 37 steps of the trace


crypto/ocsp/ocsp_ext.c:244:1: start of procedure ocsp_add1_nonce()
242.    */
243.   
244. > static int ocsp_add1_nonce(STACK_OF(X509_EXTENSION) **exts,
245.                              unsigned char *val, int len)
246.   {

crypto/ocsp/ocsp_ext.c:249:5: 
247.       unsigned char *tmpval;
248.       ASN1_OCTET_STRING os;
249. >     int ret = 0;
250.       if (len <= 0)
251.           len = OCSP_DEFAULT_NONCE_LENGTH;

crypto/ocsp/ocsp_ext.c:250:9: Taking false branch
248.       ASN1_OCTET_STRING os;
249.       int ret = 0;
250.       if (len <= 0)
               ^
251.           len = OCSP_DEFAULT_NONCE_LENGTH;
252.       /*

crypto/ocsp/ocsp_ext.c:258:5: 
256.        * relies on library internals.
257.        */
258. >     os.length = ASN1_object_size(0, len, V_ASN1_OCTET_STRING);
259.       if (os.length < 0)
260.           return 0;

crypto/asn1/asn1_lib.c:208:1: start of procedure ASN1_object_size()
  206.   }
  207.   
  208. > int ASN1_object_size(int constructed, int length, int tag)
  209.   {
  210.       int ret = 1;

crypto/asn1/asn1_lib.c:210:5: 
  208.   int ASN1_object_size(int constructed, int length, int tag)
  209.   {
  210. >     int ret = 1;
  211.       if (length < 0)
  212.           return -1;

crypto/asn1/asn1_lib.c:211:9: Taking false branch
  209.   {
  210.       int ret = 1;
  211.       if (length < 0)
                 ^
  212.           return -1;
  213.       if (tag >= 31) {

crypto/asn1/asn1_lib.c:213:9: Taking false branch
  211.       if (length < 0)
  212.           return -1;
  213.       if (tag >= 31) {
                 ^
  214.           while (tag > 0) {
  215.               tag >>= 7;

crypto/asn1/asn1_lib.c:219:9: Taking false branch
  217.           }
  218.       }
  219.       if (constructed == 2) {
                 ^
  220.           ret += 3;
  221.       } else {

crypto/asn1/asn1_lib.c:222:9: 
  220.           ret += 3;
  221.       } else {
  222. >         ret++;
  223.           if (length > 127) {
  224.               int tmplen = length;

crypto/asn1/asn1_lib.c:223:13: Taking true branch
  221.       } else {
  222.           ret++;
  223.           if (length > 127) {
                     ^
  224.               int tmplen = length;
  225.               while (tmplen > 0) {

crypto/asn1/asn1_lib.c:224:13: 
  222.           ret++;
  223.           if (length > 127) {
  224. >             int tmplen = length;
  225.               while (tmplen > 0) {
  226.                   tmplen >>= 8;

crypto/asn1/asn1_lib.c:225:20: Loop condition is true. Entering loop body
  223.           if (length > 127) {
  224.               int tmplen = length;
  225.               while (tmplen > 0) {
                            ^
  226.                   tmplen >>= 8;
  227.                   ret++;

crypto/asn1/asn1_lib.c:226:17: 
  224.               int tmplen = length;
  225.               while (tmplen > 0) {
  226. >                 tmplen >>= 8;
  227.                   ret++;
  228.               }

crypto/asn1/asn1_lib.c:227:17: 
  225.               while (tmplen > 0) {
  226.                   tmplen >>= 8;
  227. >                 ret++;
  228.               }
  229.           }

crypto/asn1/asn1_lib.c:225:20: Loop condition is false. Leaving loop
  223.           if (length > 127) {
  224.               int tmplen = length;
  225.               while (tmplen > 0) {
                            ^
  226.                   tmplen >>= 8;
  227.                   ret++;

crypto/asn1/asn1_lib.c:231:9: Taking false branch
  229.           }
  230.       }
  231.       if (ret >= INT_MAX - length)
                 ^
  232.           return -1;
  233.       return ret + length;

crypto/asn1/asn1_lib.c:233:5: 
  231.       if (ret >= INT_MAX - length)
  232.           return -1;
  233. >     return ret + length;
  234.   }
  235.   

crypto/asn1/asn1_lib.c:234:1: return from a call to ASN1_object_size
  232.           return -1;
  233.       return ret + length;
  234. > }
  235.   
  236.   int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str)

crypto/ocsp/ocsp_ext.c:259:9: Taking false branch
257.        */
258.       os.length = ASN1_object_size(0, len, V_ASN1_OCTET_STRING);
259.       if (os.length < 0)
               ^
260.           return 0;
261.   

crypto/ocsp/ocsp_ext.c:262:5: 
260.           return 0;
261.   
262. >     os.data = OPENSSL_malloc(os.length);
263.       if (os.data == NULL)
264.           goto err;

crypto/mem.c:158:1: start of procedure CRYPTO_malloc()
  156.   #endif
  157.   
  158. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  159.   {
  160.       void *ret = NULL;

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

crypto/mem.c:162:9: Taking false branch
  160.       void *ret = NULL;
  161.   
  162.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  163.           return malloc_impl(num, file, line);
  164.   

crypto/mem.c:165:9: Taking false branch
  163.           return malloc_impl(num, file, line);
  164.   
  165.       if (num == 0)
                 ^
  166.           return NULL;
  167.   

crypto/mem.c:169:5: 
  167.   
  168.       FAILTEST();
  169. >     allow_customize = 0;
  170.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  171.       if (call_malloc_debug) {

crypto/mem.c:179:5: 
  177.       }
  178.   #else
  179. >     osslargused(file); osslargused(line);
  180.       ret = malloc(num);
  181.   #endif

crypto/mem.c:179:24: 
  177.       }
  178.   #else
  179. >     osslargused(file); osslargused(line);
  180.       ret = malloc(num);
  181.   #endif

crypto/mem.c:180:5: 
  178.   #else
  179.       osslargused(file); osslargused(line);
  180. >     ret = malloc(num);
  181.   #endif
  182.   

crypto/mem.c:183:5: 
  181.   #endif
  182.   
  183. >     return ret;
  184.   }
  185.   

crypto/mem.c:184:1: return from a call to CRYPTO_malloc
  182.   
  183.       return ret;
  184. > }
  185.   
  186.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/ocsp/ocsp_ext.c:263:9: Taking false branch
261.   
262.       os.data = OPENSSL_malloc(os.length);
263.       if (os.data == NULL)
               ^
264.           goto err;
265.       tmpval = os.data;

crypto/ocsp/ocsp_ext.c:265:5: 
263.       if (os.data == NULL)
264.           goto err;
265. >     tmpval = os.data;
266.       ASN1_put_object(&tmpval, 0, len, V_ASN1_OCTET_STRING, V_ASN1_UNIVERSAL);
267.       if (val)

crypto/ocsp/ocsp_ext.c:266:5: Skipping ASN1_put_object(): empty list of specs
264.           goto err;
265.       tmpval = os.data;
266.       ASN1_put_object(&tmpval, 0, len, V_ASN1_OCTET_STRING, V_ASN1_UNIVERSAL);
           ^
267.       if (val)
268.           memcpy(tmpval, val, len);

crypto/ocsp/ocsp_ext.c:267:9: Taking true branch
265.       tmpval = os.data;
266.       ASN1_put_object(&tmpval, 0, len, V_ASN1_OCTET_STRING, V_ASN1_UNIVERSAL);
267.       if (val)
               ^
268.           memcpy(tmpval, val, len);
269.       else if (RAND_bytes(tmpval, len) <= 0)

crypto/ocsp/ocsp_ext.c:268:9: 
266.       ASN1_put_object(&tmpval, 0, len, V_ASN1_OCTET_STRING, V_ASN1_UNIVERSAL);
267.       if (val)
268. >         memcpy(tmpval, val, len);
269.       else if (RAND_bytes(tmpval, len) <= 0)
270.           goto err;

crypto/ocsp/ocsp_ext.c:271:10: Skipping X509V3_add1_i2d(): empty list of specs
269.       else if (RAND_bytes(tmpval, len) <= 0)
270.           goto err;
271.       if (!X509V3_add1_i2d(exts, NID_id_pkix_OCSP_Nonce,
                ^
272.                            &os, 0, X509V3_ADD_REPLACE))
273.           goto err;
