ssl/d1_lib.c:139: error: MEMORY_LEAK
  memory dynamically allocated by call to `DTLS_RECORD_LAYER_new()` at line 135, column 10 is not reachable after line 139, column 10.
Showing all 82 steps of the trace


ssl/d1_lib.c:131:1: start of procedure dtls1_new()
129.   }
130.   
131. > int dtls1_new(SSL *s)
132.   {
133.       DTLS1_STATE *d1;

ssl/d1_lib.c:135:10: 
133.       DTLS1_STATE *d1;
134.   
135. >     if (!DTLS_RECORD_LAYER_new(&s->rlayer)) {
136.           return 0;
137.       }

ssl/record/rec_layer_d1.c:125:1: start of procedure DTLS_RECORD_LAYER_new()
  123.   #include "record_locl.h"
  124.   
  125. > int DTLS_RECORD_LAYER_new(RECORD_LAYER *rl)
  126.   {
  127.       DTLS_RECORD_LAYER *d;

ssl/record/rec_layer_d1.c:129:9: 
  127.       DTLS_RECORD_LAYER *d;
  128.       
  129. >     if ((d = OPENSSL_malloc(sizeof(*d))) == NULL)
  130.           return (0);
  131.   

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

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

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

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

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

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

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

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

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

ssl/record/rec_layer_d1.c:129:9: Taking false branch
  127.       DTLS_RECORD_LAYER *d;
  128.       
  129.       if ((d = OPENSSL_malloc(sizeof(*d))) == NULL)
                 ^
  130.           return (0);
  131.   

ssl/record/rec_layer_d1.c:133:5: 
  131.   
  132.   
  133. >     rl->d = d;
  134.   
  135.       d->unprocessed_rcds.q = pqueue_new();

ssl/record/rec_layer_d1.c:135:5: 
  133.       rl->d = d;
  134.   
  135. >     d->unprocessed_rcds.q = pqueue_new();
  136.       d->processed_rcds.q = pqueue_new();
  137.       d->buffered_app_data.q = pqueue_new();

ssl/pqueue.c:87:1: start of procedure pqueue_new()
    85.   }
    86.   
    87. > pqueue *pqueue_new()
    88.   {
    89.       pqueue *pq = OPENSSL_zalloc(sizeof(*pq));

ssl/pqueue.c:89:5: 
    87.   pqueue *pqueue_new()
    88.   {
    89. >     pqueue *pq = OPENSSL_zalloc(sizeof(*pq));
    90.   
    91.       return pq;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

ssl/pqueue.c:91:5: 
    89.       pqueue *pq = OPENSSL_zalloc(sizeof(*pq));
    90.   
    91. >     return pq;
    92.   }
    93.   

ssl/pqueue.c:92:1: return from a call to pqueue_new
    90.   
    91.       return pq;
    92. > }
    93.   
    94.   void pqueue_free(pqueue *pq)

ssl/record/rec_layer_d1.c:136:5: 
  134.   
  135.       d->unprocessed_rcds.q = pqueue_new();
  136. >     d->processed_rcds.q = pqueue_new();
  137.       d->buffered_app_data.q = pqueue_new();
  138.   

ssl/pqueue.c:87:1: start of procedure pqueue_new()
    85.   }
    86.   
    87. > pqueue *pqueue_new()
    88.   {
    89.       pqueue *pq = OPENSSL_zalloc(sizeof(*pq));

ssl/pqueue.c:89:5: 
    87.   pqueue *pqueue_new()
    88.   {
    89. >     pqueue *pq = OPENSSL_zalloc(sizeof(*pq));
    90.   
    91.       return pq;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

ssl/pqueue.c:91:5: 
    89.       pqueue *pq = OPENSSL_zalloc(sizeof(*pq));
    90.   
    91. >     return pq;
    92.   }
    93.   

ssl/pqueue.c:92:1: return from a call to pqueue_new
    90.   
    91.       return pq;
    92. > }
    93.   
    94.   void pqueue_free(pqueue *pq)

ssl/record/rec_layer_d1.c:137:5: 
  135.       d->unprocessed_rcds.q = pqueue_new();
  136.       d->processed_rcds.q = pqueue_new();
  137. >     d->buffered_app_data.q = pqueue_new();
  138.   
  139.       if (d->unprocessed_rcds.q == NULL || d->processed_rcds.q == NULL

ssl/pqueue.c:87:1: start of procedure pqueue_new()
    85.   }
    86.   
    87. > pqueue *pqueue_new()
    88.   {
    89.       pqueue *pq = OPENSSL_zalloc(sizeof(*pq));

ssl/pqueue.c:89:5: 
    87.   pqueue *pqueue_new()
    88.   {
    89. >     pqueue *pq = OPENSSL_zalloc(sizeof(*pq));
    90.   
    91.       return pq;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

ssl/pqueue.c:91:5: 
    89.       pqueue *pq = OPENSSL_zalloc(sizeof(*pq));
    90.   
    91. >     return pq;
    92.   }
    93.   

ssl/pqueue.c:92:1: return from a call to pqueue_new
    90.   
    91.       return pq;
    92. > }
    93.   
    94.   void pqueue_free(pqueue *pq)

ssl/record/rec_layer_d1.c:139:9: Taking false branch
  137.       d->buffered_app_data.q = pqueue_new();
  138.   
  139.       if (d->unprocessed_rcds.q == NULL || d->processed_rcds.q == NULL
                 ^
  140.           || d->buffered_app_data.q == NULL) {
  141.           pqueue_free(d->unprocessed_rcds.q);

ssl/record/rec_layer_d1.c:139:42: Taking false branch
  137.       d->buffered_app_data.q = pqueue_new();
  138.   
  139.       if (d->unprocessed_rcds.q == NULL || d->processed_rcds.q == NULL
                                                  ^
  140.           || d->buffered_app_data.q == NULL) {
  141.           pqueue_free(d->unprocessed_rcds.q);

ssl/record/rec_layer_d1.c:140:12: Taking false branch
  138.   
  139.       if (d->unprocessed_rcds.q == NULL || d->processed_rcds.q == NULL
  140.           || d->buffered_app_data.q == NULL) {
                    ^
  141.           pqueue_free(d->unprocessed_rcds.q);
  142.           pqueue_free(d->processed_rcds.q);

ssl/record/rec_layer_d1.c:149:5: 
  147.       }
  148.   
  149. >     return 1;
  150.   }
  151.   

ssl/record/rec_layer_d1.c:150:1: return from a call to DTLS_RECORD_LAYER_new
  148.   
  149.       return 1;
  150. > }
  151.   
  152.   void DTLS_RECORD_LAYER_free(RECORD_LAYER *rl)

ssl/d1_lib.c:135:10: Taking false branch
133.       DTLS1_STATE *d1;
134.   
135.       if (!DTLS_RECORD_LAYER_new(&s->rlayer)) {
                ^
136.           return 0;
137.       }

ssl/d1_lib.c:139:10: Skipping ssl3_new(): empty list of specs
137.       }
138.       
139.       if (!ssl3_new(s))
                ^
140.           return (0);
141.       if ((d1 = OPENSSL_zalloc(sizeof(*d1))) == NULL) {

int dtls1_new(SSL *s)
{
    DTLS1_STATE *d1;
    if (!DTLS_RECORD_LAYER_new(&s->rlayer)) {
        return 0;
    }
    if (!ssl3_new(s))
        return (0);
    if ((d1 = OPENSSL_zalloc(sizeof(*d1))) == NULL) {
        ssl3_free(s);
        return (0);
    }
    d1->buffered_messages = pqueue_new();
    d1->sent_messages = pqueue_new();
    if (s->server) {
        d1->cookie_len = sizeof(s->d1->cookie);
    }
    d1->link_mtu = 0;
    d1->mtu = 0;
    if (d1->buffered_messages == NULL || d1->sent_messages == NULL) {
        pqueue_free(d1->buffered_messages);
        pqueue_free(d1->sent_messages);
        OPENSSL_free(d1);
        ssl3_free(s);
        return (0);
    }
    s->d1 = d1;
    s->method->ssl_clear(s);
    return (1);
}
['int dtls1_new(SSL *s)\n{\n    DTLS1_STATE *d1;\n    if (!DTLS_RECORD_LAYER_new(&s->rlayer)) {\n        return 0;\n    }\n    if (!ssl3_new(s))\n        return (0);\n    if ((d1 = OPENSSL_zalloc(sizeof(*d1))) == NULL) {\n        ssl3_free(s);\n        return (0);\n    }\n    d1->buffered_messages = pqueue_new();\n    d1->sent_messages = pqueue_new();\n    if (s->server) {\n        d1->cookie_len = sizeof(s->d1->cookie);\n    }\n    d1->link_mtu = 0;\n    d1->mtu = 0;\n    if (d1->buffered_messages == NULL || d1->sent_messages == NULL) {\n        pqueue_free(d1->buffered_messages);\n        pqueue_free(d1->sent_messages);\n        OPENSSL_free(d1);\n        ssl3_free(s);\n        return (0);\n    }\n    s->d1 = d1;\n    s->method->ssl_clear(s);\n    return (1);\n}', 'int DTLS_RECORD_LAYER_new(RECORD_LAYER *rl)\n{\n    DTLS_RECORD_LAYER *d;\n    if ((d = OPENSSL_malloc(sizeof(*d))) == NULL)\n        return (0);\n    rl->d = d;\n    d->unprocessed_rcds.q = pqueue_new();\n    d->processed_rcds.q = pqueue_new();\n    d->buffered_app_data.q = pqueue_new();\n    if (d->unprocessed_rcds.q == NULL || d->processed_rcds.q == NULL\n        || d->buffered_app_data.q == NULL) {\n        pqueue_free(d->unprocessed_rcds.q);\n        pqueue_free(d->processed_rcds.q);\n        pqueue_free(d->buffered_app_data.q);\n        OPENSSL_free(d);\n        rl->d = NULL;\n        return (0);\n    }\n    return 1;\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}', 'pqueue *pqueue_new()\n{\n    pqueue *pq = OPENSSL_zalloc(sizeof(*pq));\n    return pq;\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}']