crypto/x509v3/pcy_data.c:102: error: MEMORY_LEAK
  memory dynamically allocated to `return` by call to `OBJ_dup()` at line 95, column 14 is not reachable after line 102, column 9.
Showing all 100 steps of the trace


crypto/x509v3/pcy_data.c:87:1: start of procedure policy_data_new()
85.    */
86.   
87. > X509_POLICY_DATA *policy_data_new(POLICYINFO *policy,
88.                                     const ASN1_OBJECT *cid, int crit)
89.   {

crypto/x509v3/pcy_data.c:92:10: Taking false branch
90.       X509_POLICY_DATA *ret;
91.       ASN1_OBJECT *id;
92.       if (!policy && !cid)
               ^
93.           return NULL;
94.       if (cid) {

crypto/x509v3/pcy_data.c:94:9: Taking true branch
92.       if (!policy && !cid)
93.           return NULL;
94.       if (cid) {
              ^
95.           id = OBJ_dup(cid);
96.           if (!id)

crypto/x509v3/pcy_data.c:95:9: 
93.           return NULL;
94.       if (cid) {
95. >         id = OBJ_dup(cid);
96.           if (!id)
97.               return NULL;

crypto/objects/obj_lib.c:65:1: start of procedure OBJ_dup()
  63.   #include "internal/asn1_int.h"
  64.   
  65. > ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o)
  66.   {
  67.       ASN1_OBJECT *r;

crypto/objects/obj_lib.c:69:5: 
  67.       ASN1_OBJECT *r;
  68.       int i;
  69. >     char *ln = NULL, *sn = NULL;
  70.       unsigned char *data = NULL;
  71.   

crypto/objects/obj_lib.c:70:5: 
  68.       int i;
  69.       char *ln = NULL, *sn = NULL;
  70. >     unsigned char *data = NULL;
  71.   
  72.       if (o == NULL)

crypto/objects/obj_lib.c:72:9: Taking false branch
  70.       unsigned char *data = NULL;
  71.   
  72.       if (o == NULL)
                ^
  73.           return (NULL);
  74.       if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC))

crypto/objects/obj_lib.c:74:11: Taking false branch
  72.       if (o == NULL)
  73.           return (NULL);
  74.       if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC))
                  ^
  75.           return ((ASN1_OBJECT *)o); /* XXX: ugh! Why? What kind of duplication
  76.                                       * is this??? */

crypto/objects/obj_lib.c:78:5: 
  76.                                       * is this??? */
  77.   
  78. >     r = ASN1_OBJECT_new();
  79.       if (r == NULL) {
  80.           OBJerr(OBJ_F_OBJ_DUP, ERR_R_ASN1_LIB);

crypto/asn1/a_object.c:366:1: start of procedure ASN1_OBJECT_new()
    364.   }
    365.   
    366. > ASN1_OBJECT *ASN1_OBJECT_new(void)
    367.   {
    368.       ASN1_OBJECT *ret;

crypto/asn1/a_object.c:370:5: 
    368.       ASN1_OBJECT *ret;
    369.   
    370. >     ret = OPENSSL_zalloc(sizeof(*ret));
    371.       if (ret == NULL) {
    372.           ASN1err(ASN1_F_ASN1_OBJECT_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/a_object.c:371:9: Taking false branch
    369.   
    370.       ret = OPENSSL_zalloc(sizeof(*ret));
    371.       if (ret == NULL) {
                   ^
    372.           ASN1err(ASN1_F_ASN1_OBJECT_NEW, ERR_R_MALLOC_FAILURE);
    373.           return (NULL);

crypto/asn1/a_object.c:375:5: 
    373.           return (NULL);
    374.       }
    375. >     ret->flags = ASN1_OBJECT_FLAG_DYNAMIC;
    376.       return (ret);
    377.   }

crypto/asn1/a_object.c:376:5: 
    374.       }
    375.       ret->flags = ASN1_OBJECT_FLAG_DYNAMIC;
    376. >     return (ret);
    377.   }
    378.   

crypto/asn1/a_object.c:377:1: return from a call to ASN1_OBJECT_new
    375.       ret->flags = ASN1_OBJECT_FLAG_DYNAMIC;
    376.       return (ret);
    377. > }
    378.   
    379.   void ASN1_OBJECT_free(ASN1_OBJECT *a)

crypto/objects/obj_lib.c:79:9: Taking false branch
  77.   
  78.       r = ASN1_OBJECT_new();
  79.       if (r == NULL) {
                ^
  80.           OBJerr(OBJ_F_OBJ_DUP, ERR_R_ASN1_LIB);
  81.           return (NULL);

crypto/objects/obj_lib.c:83:5: 
  81.           return (NULL);
  82.       }
  83. >     data = OPENSSL_malloc(o->length);
  84.       if (data == NULL)
  85.           goto err;

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/objects/obj_lib.c:84:9: Taking false branch
  82.       }
  83.       data = OPENSSL_malloc(o->length);
  84.       if (data == NULL)
                ^
  85.           goto err;
  86.       if (o->data != NULL)

crypto/objects/obj_lib.c:86:9: Taking true branch
  84.       if (data == NULL)
  85.           goto err;
  86.       if (o->data != NULL)
                ^
  87.           memcpy(data, o->data, o->length);
  88.       /* once data attached to object it remains const */

crypto/objects/obj_lib.c:87:9: 
  85.           goto err;
  86.       if (o->data != NULL)
  87. >         memcpy(data, o->data, o->length);
  88.       /* once data attached to object it remains const */
  89.       r->data = data;

crypto/objects/obj_lib.c:89:5: 
  87.           memcpy(data, o->data, o->length);
  88.       /* once data attached to object it remains const */
  89. >     r->data = data;
  90.       r->length = o->length;
  91.       r->nid = o->nid;

crypto/objects/obj_lib.c:90:5: 
  88.       /* once data attached to object it remains const */
  89.       r->data = data;
  90. >     r->length = o->length;
  91.       r->nid = o->nid;
  92.       r->ln = r->sn = NULL;

crypto/objects/obj_lib.c:91:5: 
  89.       r->data = data;
  90.       r->length = o->length;
  91. >     r->nid = o->nid;
  92.       r->ln = r->sn = NULL;
  93.       if (o->ln != NULL) {

crypto/objects/obj_lib.c:92:5: 
  90.       r->length = o->length;
  91.       r->nid = o->nid;
  92. >     r->ln = r->sn = NULL;
  93.       if (o->ln != NULL) {
  94.           i = strlen(o->ln) + 1;

crypto/objects/obj_lib.c:93:9: Taking true branch
  91.       r->nid = o->nid;
  92.       r->ln = r->sn = NULL;
  93.       if (o->ln != NULL) {
                ^
  94.           i = strlen(o->ln) + 1;
  95.           ln = OPENSSL_malloc(i);

crypto/objects/obj_lib.c:94:9: 
  92.       r->ln = r->sn = NULL;
  93.       if (o->ln != NULL) {
  94. >         i = strlen(o->ln) + 1;
  95.           ln = OPENSSL_malloc(i);
  96.           if (ln == NULL)

crypto/objects/obj_lib.c:95:9: 
  93.       if (o->ln != NULL) {
  94.           i = strlen(o->ln) + 1;
  95. >         ln = OPENSSL_malloc(i);
  96.           if (ln == NULL)
  97.               goto err;

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/objects/obj_lib.c:96:13: Taking false branch
  94.           i = strlen(o->ln) + 1;
  95.           ln = OPENSSL_malloc(i);
  96.           if (ln == NULL)
                    ^
  97.               goto err;
  98.           memcpy(ln, o->ln, i);

crypto/objects/obj_lib.c:98:9: 
  96.           if (ln == NULL)
  97.               goto err;
  98. >         memcpy(ln, o->ln, i);
  99.           r->ln = ln;
  100.       }

crypto/objects/obj_lib.c:99:9: 
  97.               goto err;
  98.           memcpy(ln, o->ln, i);
  99. >         r->ln = ln;
  100.       }
  101.   

crypto/objects/obj_lib.c:102:9: Taking true branch
  100.       }
  101.   
  102.       if (o->sn != NULL) {
                 ^
  103.           i = strlen(o->sn) + 1;
  104.           sn = OPENSSL_malloc(i);

crypto/objects/obj_lib.c:103:9: 
  101.   
  102.       if (o->sn != NULL) {
  103. >         i = strlen(o->sn) + 1;
  104.           sn = OPENSSL_malloc(i);
  105.           if (sn == NULL)

crypto/objects/obj_lib.c:104:9: 
  102.       if (o->sn != NULL) {
  103.           i = strlen(o->sn) + 1;
  104. >         sn = OPENSSL_malloc(i);
  105.           if (sn == NULL)
  106.               goto err;

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/objects/obj_lib.c:105:13: Taking false branch
  103.           i = strlen(o->sn) + 1;
  104.           sn = OPENSSL_malloc(i);
  105.           if (sn == NULL)
                     ^
  106.               goto err;
  107.           memcpy(sn, o->sn, i);

crypto/objects/obj_lib.c:107:9: 
  105.           if (sn == NULL)
  106.               goto err;
  107. >         memcpy(sn, o->sn, i);
  108.           r->sn = sn;
  109.       }

crypto/objects/obj_lib.c:108:9: 
  106.               goto err;
  107.           memcpy(sn, o->sn, i);
  108. >         r->sn = sn;
  109.       }
  110.       r->flags = o->flags | (ASN1_OBJECT_FLAG_DYNAMIC |

crypto/objects/obj_lib.c:110:5: 
  108.           r->sn = sn;
  109.       }
  110. >     r->flags = o->flags | (ASN1_OBJECT_FLAG_DYNAMIC |
  111.                              ASN1_OBJECT_FLAG_DYNAMIC_STRINGS |
  112.                              ASN1_OBJECT_FLAG_DYNAMIC_DATA);

crypto/objects/obj_lib.c:113:5: 
  111.                              ASN1_OBJECT_FLAG_DYNAMIC_STRINGS |
  112.                              ASN1_OBJECT_FLAG_DYNAMIC_DATA);
  113. >     return (r);
  114.    err:
  115.       OBJerr(OBJ_F_OBJ_DUP, ERR_R_MALLOC_FAILURE);

crypto/objects/obj_lib.c:121:1: return from a call to OBJ_dup
  119.       OPENSSL_free(r);
  120.       return (NULL);
  121. > }
  122.   
  123.   int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b)

crypto/x509v3/pcy_data.c:96:14: Taking false branch
94.       if (cid) {
95.           id = OBJ_dup(cid);
96.           if (!id)
                   ^
97.               return NULL;
98.       } else

crypto/x509v3/pcy_data.c:100:5: 
98.       } else
99.           id = NULL;
100. >     ret = OPENSSL_zalloc(sizeof(*ret));
101.       if (ret == NULL)
102.           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 false 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: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/x509v3/pcy_data.c:101:9: Taking true branch
99.           id = NULL;
100.       ret = OPENSSL_zalloc(sizeof(*ret));
101.       if (ret == NULL)
               ^
102.           return NULL;
103.       ret->expected_policy_set = sk_ASN1_OBJECT_new_null();

crypto/x509v3/pcy_data.c:102:9: 
100.       ret = OPENSSL_zalloc(sizeof(*ret));
101.       if (ret == NULL)
102. >         return NULL;
103.       ret->expected_policy_set = sk_ASN1_OBJECT_new_null();
104.       if (ret->expected_policy_set == NULL) {
