crypto/x509v3/v3_sxnet.c:261: error: MEMORY_LEAK
  memory dynamically allocated by call to `ASN1_INTEGER_new()` at line 254, column 18 is not reachable after line 261, column 5.
Showing all 90 steps of the trace


crypto/x509v3/v3_sxnet.c:249:1: start of procedure SXNET_get_id_ulong()
247.   }
248.   
249. > ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone)
250.   {
251.       ASN1_INTEGER *izone;

crypto/x509v3/v3_sxnet.c:254:9: 
252.       ASN1_OCTET_STRING *oct;
253.   
254. >     if ((izone = ASN1_INTEGER_new()) == NULL
255.           || !ASN1_INTEGER_set(izone, lzone)) {
256.           X509V3err(X509V3_F_SXNET_GET_ID_ULONG, ERR_R_MALLOC_FAILURE);

crypto/asn1/tasn_typ.c:77:1: start of procedure ASN1_INTEGER_new()
  75.   
  76.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  78.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
  79.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)

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:77:1: return from a call to ASN1_INTEGER_new
  75.   
  76.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  78.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
  79.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)

crypto/x509v3/v3_sxnet.c:254:9: Taking false branch
252.       ASN1_OCTET_STRING *oct;
253.   
254.       if ((izone = ASN1_INTEGER_new()) == NULL
               ^
255.           || !ASN1_INTEGER_set(izone, lzone)) {
256.           X509V3err(X509V3_F_SXNET_GET_ID_ULONG, ERR_R_MALLOC_FAILURE);

crypto/x509v3/v3_sxnet.c:255:13: 
253.   
254.       if ((izone = ASN1_INTEGER_new()) == NULL
255. >         || !ASN1_INTEGER_set(izone, lzone)) {
256.           X509V3err(X509V3_F_SXNET_GET_ID_ULONG, ERR_R_MALLOC_FAILURE);
257.           ASN1_INTEGER_free(izone);

crypto/asn1/a_int.c:602:1: start of procedure ASN1_INTEGER_set()
  600.   }
  601.   
  602. > int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
  603.   {
  604.       return ASN1_INTEGER_set_int64(a, v);

crypto/asn1/a_int.c:604:5: 
  602.   int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
  603.   {
  604. >     return ASN1_INTEGER_set_int64(a, v);
  605.   }
  606.   

crypto/asn1/a_int.c:587:1: start of procedure ASN1_INTEGER_set_int64()
    585.   }
    586.   
    587. > int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r)
    588.   {
    589.       return asn1_string_set_int64(a, r, V_ASN1_INTEGER);

crypto/asn1/a_int.c:589:5: 
    587.   int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r)
    588.   {
    589. >     return asn1_string_set_int64(a, r, V_ASN1_INTEGER);
    590.   }
    591.   

crypto/asn1/a_int.c:404:1: start of procedure asn1_string_set_int64()
      402.   }
      403.   
      404. > static int asn1_string_set_int64(ASN1_STRING *a, int64_t r, int itype)
      405.   {
      406.       unsigned char tbuf[sizeof(r)];

crypto/asn1/a_int.c:408:5: 
      406.       unsigned char tbuf[sizeof(r)];
      407.       size_t l;
      408. >     a->type = itype;
      409.       if (r < 0) {
      410.           l = asn1_put_uint64(tbuf, -r);

crypto/asn1/a_int.c:409:9: Taking false branch
      407.       size_t l;
      408.       a->type = itype;
      409.       if (r < 0) {
                     ^
      410.           l = asn1_put_uint64(tbuf, -r);
      411.           a->type |= V_ASN1_NEG;

crypto/asn1/a_int.c:413:9: 
      411.           a->type |= V_ASN1_NEG;
      412.       } else {
      413. >         l = asn1_put_uint64(tbuf, r);
      414.           a->type &= ~V_ASN1_NEG;
      415.       }

crypto/asn1/a_int.c:291:1: start of procedure asn1_put_uint64()
        289.   }
        290.   
        291. > static size_t asn1_put_uint64(unsigned char *b, uint64_t r)
        292.   {
        293.       if (r >= 0x100) {

crypto/asn1/a_int.c:293:9: Taking false branch
        291.   static size_t asn1_put_uint64(unsigned char *b, uint64_t r)
        292.   {
        293.       if (r >= 0x100) {
                       ^
        294.           unsigned char *p;
        295.           uint64_t rtmp = r;

crypto/asn1/a_int.c:315:5: 
        313.       }
        314.   
        315. >     b[0] = (unsigned char)r;
        316.       return 1;
        317.   

crypto/asn1/a_int.c:316:5: 
        314.   
        315.       b[0] = (unsigned char)r;
        316. >     return 1;
        317.   
        318.   }

crypto/asn1/a_int.c:318:1: return from a call to asn1_put_uint64
        316.       return 1;
        317.   
        318. > }
        319.   
        320.   /*

crypto/asn1/a_int.c:414:9: 
      412.       } else {
      413.           l = asn1_put_uint64(tbuf, r);
      414. >         a->type &= ~V_ASN1_NEG;
      415.       }
      416.       if (l == 0)

crypto/asn1/a_int.c:416:9: Taking false branch
      414.           a->type &= ~V_ASN1_NEG;
      415.       }
      416.       if (l == 0)
                     ^
      417.           return 0;
      418.       return ASN1_STRING_set(a, tbuf, l);

crypto/asn1/a_int.c:418:5: 
      416.       if (l == 0)
      417.           return 0;
      418. >     return ASN1_STRING_set(a, tbuf, l);
      419.   }
      420.   

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 false branch
        310.       const char *data = _data;
        311.   
        312.       if (len < 0) {
                       ^
        313.           if (data == NULL)
        314.               return (0);

crypto/asn1/asn1_lib.c:318:10: Taking true 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:319:9: 
        317.       }
        318.       if ((str->length < len) || (str->data == NULL)) {
        319. >         c = str->data;
        320.           str->data = OPENSSL_realloc(c, len + 1);
        321.           if (str->data == NULL) {

crypto/asn1/asn1_lib.c:320:9: 
        318.       if ((str->length < len) || (str->data == NULL)) {
        319.           c = str->data;
        320. >         str->data = OPENSSL_realloc(c, len + 1);
        321.           if (str->data == NULL) {
        322.               ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);

crypto/mem.c:165:1: start of procedure CRYPTO_realloc()
          163.   }
          164.   
          165. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
          166.   {
          167.       if (str == NULL)

crypto/mem.c:167:9: Taking false branch
          165.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
          166.   {
          167.       if (str == NULL)
                         ^
          168.           return CRYPTO_malloc(num, file, line);
          169.   

crypto/mem.c:170:9: Taking false branch
          168.           return CRYPTO_malloc(num, file, line);
          169.   
          170.       if (num == 0) {
                         ^
          171.           CRYPTO_free(str);
          172.           return NULL;

crypto/mem.c:175:5: 
          173.       }
          174.   
          175. >     allow_customize = 0;
          176.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
          177.       if (call_malloc_debug) {

crypto/mem.c:185:5: 
          183.       }
          184.   #else
          185. >     (void)file;
          186.       (void)line;
          187.   #endif

crypto/mem.c:186:5: 
          184.   #else
          185.       (void)file;
          186. >     (void)line;
          187.   #endif
          188.       return realloc(str, num);

crypto/mem.c:188:5: 
          186.       (void)line;
          187.   #endif
          188. >     return realloc(str, num);
          189.   
          190.   }

crypto/mem.c:190:1: return from a call to CRYPTO_realloc
          188.       return realloc(str, num);
          189.   
          190. > }
          191.   
          192.   void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,

crypto/asn1/asn1_lib.c:321:13: Taking false branch
        319.           c = str->data;
        320.           str->data = OPENSSL_realloc(c, len + 1);
        321.           if (str->data == NULL) {
                           ^
        322.               ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);
        323.               str->data = c;

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_int.c:419:1: return from a call to asn1_string_set_int64
      417.           return 0;
      418.       return ASN1_STRING_set(a, tbuf, l);
      419. > }
      420.   
      421.   static int asn1_string_get_uint64(uint64_t *pr, const ASN1_STRING *a,

crypto/asn1/a_int.c:590:1: return from a call to ASN1_INTEGER_set_int64
    588.   {
    589.       return asn1_string_set_int64(a, r, V_ASN1_INTEGER);
    590. > }
    591.   
    592.   int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a)

crypto/asn1/a_int.c:605:1: return from a call to ASN1_INTEGER_set
  603.   {
  604.       return ASN1_INTEGER_set_int64(a, v);
  605. > }
  606.   
  607.   long ASN1_INTEGER_get(const ASN1_INTEGER *a)

crypto/x509v3/v3_sxnet.c:255:13: Taking false branch
253.   
254.       if ((izone = ASN1_INTEGER_new()) == NULL
255.           || !ASN1_INTEGER_set(izone, lzone)) {
                   ^
256.           X509V3err(X509V3_F_SXNET_GET_ID_ULONG, ERR_R_MALLOC_FAILURE);
257.           ASN1_INTEGER_free(izone);

crypto/x509v3/v3_sxnet.c:260:5: 
258.           return NULL;
259.       }
260. >     oct = SXNET_get_id_INTEGER(sx, izone);
261.       ASN1_INTEGER_free(izone);
262.       return oct;

crypto/x509v3/v3_sxnet.c:265:1: start of procedure SXNET_get_id_INTEGER()
  263.   }
  264.   
  265. > ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone)
  266.   {
  267.       SXNETID *id;

crypto/x509v3/v3_sxnet.c:269:10: 
  267.       SXNETID *id;
  268.       int i;
  269. >     for (i = 0; i < sk_SXNETID_num(sx->ids); i++) {
  270.           id = sk_SXNETID_value(sx->ids, i);
  271.           if (!ASN1_INTEGER_cmp(id->zone, zone))

crypto/x509v3/v3_sxnet.c:269:17: 
  267.       SXNETID *id;
  268.       int i;
  269. >     for (i = 0; i < sk_SXNETID_num(sx->ids); i++) {
  270.           id = sk_SXNETID_value(sx->ids, i);
  271.           if (!ASN1_INTEGER_cmp(id->zone, zone))

include/openssl/x509v3.h:273:1: start of procedure sk_SXNETID_num()
    271.   } SXNETID;
    272.   
    273. > DEFINE_STACK_OF(SXNETID)
    274.   
    275.   typedef struct SXNET_st {

crypto/stack/stack.c:316:1: start of procedure sk_num()
      314.   }
      315.   
      316. > int sk_num(const _STACK *st)
      317.   {
      318.       if (st == NULL)

crypto/stack/stack.c:318:9: Taking true branch
      316.   int sk_num(const _STACK *st)
      317.   {
      318.       if (st == NULL)
                     ^
      319.           return -1;
      320.       return st->num;

crypto/stack/stack.c:319:9: 
      317.   {
      318.       if (st == NULL)
      319. >         return -1;
      320.       return st->num;
      321.   }

crypto/stack/stack.c:321:1: return from a call to sk_num
      319.           return -1;
      320.       return st->num;
      321. > }
      322.   
      323.   void *sk_value(const _STACK *st, int i)

include/openssl/x509v3.h:273:1: return from a call to sk_SXNETID_num
    271.   } SXNETID;
    272.   
    273. > DEFINE_STACK_OF(SXNETID)
    274.   
    275.   typedef struct SXNET_st {

crypto/x509v3/v3_sxnet.c:269:17: Loop condition is false. Leaving loop
  267.       SXNETID *id;
  268.       int i;
  269.       for (i = 0; i < sk_SXNETID_num(sx->ids); i++) {
                         ^
  270.           id = sk_SXNETID_value(sx->ids, i);
  271.           if (!ASN1_INTEGER_cmp(id->zone, zone))

crypto/x509v3/v3_sxnet.c:274:5: 
  272.               return id->user;
  273.       }
  274. >     return NULL;
  275.   }

crypto/x509v3/v3_sxnet.c:275:1: return from a call to SXNET_get_id_INTEGER
  273.       }
  274.       return NULL;
  275. > }

crypto/x509v3/v3_sxnet.c:261:5: 
259.       }
260.       oct = SXNET_get_id_INTEGER(sx, izone);
261. >     ASN1_INTEGER_free(izone);
262.       return oct;
263.   }

crypto/asn1/tasn_typ.c:77:1: start of procedure ASN1_INTEGER_free()
  75.   
  76.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  78.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
  79.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)

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:77:1: return from a call to ASN1_INTEGER_free
  75.   
  76.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  78.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
  79.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)
