test/lhash_test.c:185: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_malloc()` at line 179, column 13 is not reachable after line 185, column 9.
Showing all 45 steps of the trace


test/lhash_test.c:167:1: start of procedure test_stress()
165.   }
166.   
167. > static int test_stress(void)
168.   {
169.       LHASH_OF(int) *h = lh_int_new(&stress_hash, &int_cmp);

test/lhash_test.c:169:5: 
167.   static int test_stress(void)
168.   {
169. >     LHASH_OF(int) *h = lh_int_new(&stress_hash, &int_cmp);
170.       const unsigned int n = 2500000;
171.       unsigned int i;

test/lhash_test.c:30:1: start of procedure lh_int_new()
  28.   #endif
  29.   
  30. > DEFINE_LHASH_OF(int);
  31.   
  32.   static int int_tests[] = { 65537, 13, 1, 3, -5, 6, 7, 4, -10, -12, -14, 22, 9,

test/lhash_test.c:30:1: return from a call to lh_int_new
  28.   #endif
  29.   
  30. > DEFINE_LHASH_OF(int);
  31.   
  32.   static int int_tests[] = { 65537, 13, 1, 3, -5, 6, 7, 4, -10, -12, -14, 22, 9,

test/lhash_test.c:170:5: 
168.   {
169.       LHASH_OF(int) *h = lh_int_new(&stress_hash, &int_cmp);
170. >     const unsigned int n = 2500000;
171.       unsigned int i;
172.       int testresult = 0, *p;

test/lhash_test.c:172:5: 
170.       const unsigned int n = 2500000;
171.       unsigned int i;
172. >     int testresult = 0, *p;
173.   
174.       if (!TEST_ptr(h))

test/lhash_test.c:174:10: 
172.       int testresult = 0, *p;
173.   
174. >     if (!TEST_ptr(h))
175.           goto end;
176.   

test/testutil/tests.c:227:1: start of procedure test_ptr()
  225.   }
  226.   
  227. > int test_ptr(const char *file, int line, const char *s, const void *p)
  228.   {
  229.       if (p != NULL)

test/testutil/tests.c:229:9: Taking true branch
  227.   int test_ptr(const char *file, int line, const char *s, const void *p)
  228.   {
  229.       if (p != NULL)
                 ^
  230.           return 1;
  231.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:230:9: 
  228.   {
  229.       if (p != NULL)
  230. >         return 1;
  231.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  232.       return 0;

test/testutil/tests.c:233:1: return from a call to test_ptr
  231.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  232.       return 0;
  233. > }
  234.   
  235.   int test_true(const char *file, int line, const char *s, int b)

test/lhash_test.c:174:10: Taking false branch
172.       int testresult = 0, *p;
173.   
174.       if (!TEST_ptr(h))
                ^
175.           goto end;
176.   

test/lhash_test.c:178:10: 
176.   
177.       /* insert */
178. >     for (i = 0; i < n; i++) {
179.           p = OPENSSL_malloc(sizeof(i));
180.           if (!TEST_ptr(p)) {

test/lhash_test.c:178:17: Loop condition is true. Entering loop body
176.   
177.       /* insert */
178.       for (i = 0; i < n; i++) {
                       ^
179.           p = OPENSSL_malloc(sizeof(i));
180.           if (!TEST_ptr(p)) {

test/lhash_test.c:179:9: 
177.       /* insert */
178.       for (i = 0; i < n; i++) {
179. >         p = OPENSSL_malloc(sizeof(i));
180.           if (!TEST_ptr(p)) {
181.               TEST_info("lhash stress out of memory %d", i);

crypto/mem.c:189:1: start of procedure CRYPTO_malloc()
  187.   #endif
  188.   
  189. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  190.   {
  191.       void *ret = NULL;

crypto/mem.c:191:5: 
  189.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  190.   {
  191. >     void *ret = NULL;
  192.   
  193.       INCREMENT(malloc_count);

crypto/mem.c:194:9: Taking false branch
  192.   
  193.       INCREMENT(malloc_count);
  194.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  195.           return malloc_impl(num, file, line);
  196.   

crypto/mem.c:197:9: Taking false branch
  195.           return malloc_impl(num, file, line);
  196.   
  197.       if (num == 0)
                 ^
  198.           return NULL;
  199.   

crypto/mem.c:201:5: 
  199.   
  200.       FAILTEST();
  201. >     allow_customize = 0;
  202.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  203.       if (call_malloc_debug) {

crypto/mem.c:211:5: 
  209.       }
  210.   #else
  211. >     (void)(file); (void)(line);
  212.       ret = malloc(num);
  213.   #endif

crypto/mem.c:211:19: 
  209.       }
  210.   #else
  211. >     (void)(file); (void)(line);
  212.       ret = malloc(num);
  213.   #endif

crypto/mem.c:212:5: 
  210.   #else
  211.       (void)(file); (void)(line);
  212. >     ret = malloc(num);
  213.   #endif
  214.   

crypto/mem.c:215:5: 
  213.   #endif
  214.   
  215. >     return ret;
  216.   }
  217.   

crypto/mem.c:216:1: return from a call to CRYPTO_malloc
  214.   
  215.       return ret;
  216. > }
  217.   
  218.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

test/lhash_test.c:180:14: 
178.       for (i = 0; i < n; i++) {
179.           p = OPENSSL_malloc(sizeof(i));
180. >         if (!TEST_ptr(p)) {
181.               TEST_info("lhash stress out of memory %d", i);
182.               goto end;

test/testutil/tests.c:227:1: start of procedure test_ptr()
  225.   }
  226.   
  227. > int test_ptr(const char *file, int line, const char *s, const void *p)
  228.   {
  229.       if (p != NULL)

test/testutil/tests.c:229:9: Taking true branch
  227.   int test_ptr(const char *file, int line, const char *s, const void *p)
  228.   {
  229.       if (p != NULL)
                 ^
  230.           return 1;
  231.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:230:9: 
  228.   {
  229.       if (p != NULL)
  230. >         return 1;
  231.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  232.       return 0;

test/testutil/tests.c:233:1: return from a call to test_ptr
  231.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  232.       return 0;
  233. > }
  234.   
  235.   int test_true(const char *file, int line, const char *s, int b)

test/lhash_test.c:180:14: Taking false branch
178.       for (i = 0; i < n; i++) {
179.           p = OPENSSL_malloc(sizeof(i));
180.           if (!TEST_ptr(p)) {
                    ^
181.               TEST_info("lhash stress out of memory %d", i);
182.               goto end;

test/lhash_test.c:184:9: 
182.               goto end;
183.           }
184. >         *p = 3 * i + 1;
185.           lh_int_insert(h, p);
186.       }

test/lhash_test.c:185:9: 
183.           }
184.           *p = 3 * i + 1;
185. >         lh_int_insert(h, p);
186.       }
187.   

test/lhash_test.c:30:1: start of procedure lh_int_insert()
  28.   #endif
  29.   
  30. > DEFINE_LHASH_OF(int);
  31.   
  32.   static int int_tests[] = { 65537, 13, 1, 3, -5, 6, 7, 4, -10, -12, -14, 22, 9,

crypto/lhash/lhash.c:70:1: start of procedure OPENSSL_LH_insert()
    68.   }
    69.   
    70. > void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)
    71.   {
    72.       unsigned long hash;

crypto/lhash/lhash.c:76:5: 
    74.       void *ret;
    75.   
    76. >     lh->error = 0;
    77.       if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
    78.           return NULL;        /* 'lh->error++' already done in 'expand' */

crypto/lhash/lhash.c:77:10: Taking false branch
    75.   
    76.       lh->error = 0;
    77.       if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
                   ^
    78.           return NULL;        /* 'lh->error++' already done in 'expand' */
    79.   

crypto/lhash/lhash.c:80:5: Skipping getrn(): empty list of specs
    78.           return NULL;        /* 'lh->error++' already done in 'expand' */
    79.   
    80.       rn = getrn(lh, data, &hash);
              ^
    81.   
    82.       if (*rn == NULL) {

crypto/lhash/lhash.c:82:9: Taking false branch
    80.       rn = getrn(lh, data, &hash);
    81.   
    82.       if (*rn == NULL) {
                  ^
    83.           if ((nn = OPENSSL_malloc(sizeof(*nn))) == NULL) {
    84.               lh->error++;

crypto/lhash/lhash.c:95:9: 
    93.           lh->num_items++;
    94.       } else {                    /* replace same key */
    95. >         ret = (*rn)->data;
    96.           (*rn)->data = data;
    97.           lh->num_replace++;

crypto/lhash/lhash.c:96:9: 
    94.       } else {                    /* replace same key */
    95.           ret = (*rn)->data;
    96. >         (*rn)->data = data;
    97.           lh->num_replace++;
    98.       }

crypto/lhash/lhash.c:97:9: 
    95.           ret = (*rn)->data;
    96.           (*rn)->data = data;
    97. >         lh->num_replace++;
    98.       }
    99.       return ret;

crypto/lhash/lhash.c:99:5: 
    97.           lh->num_replace++;
    98.       }
    99. >     return ret;
    100.   }
    101.   

crypto/lhash/lhash.c:100:1: return from a call to OPENSSL_LH_insert
    98.       }
    99.       return ret;
    100. > }
    101.   
    102.   void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)

test/lhash_test.c:30:1: return from a call to lh_int_insert
  28.   #endif
  29.   
  30. > DEFINE_LHASH_OF(int);
  31.   
  32.   static int int_tests[] = { 65537, 13, 1, 3, -5, 6, 7, 4, -10, -12, -14, 22, 9,
