crypto/ec/ec_lib.c:335: error: MEMORY_LEAK
  memory dynamically allocated by call to `EC_POINT_new()` at line 311, column 28 is not reachable after line 335, column 5.
Showing all 60 steps of the trace


crypto/ec/ec_lib.c:302:1: start of procedure EC_GROUP_set_generator()
300.   }
301.   
302. > int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator,
303.                              const BIGNUM *order, const BIGNUM *cofactor)
304.   {

crypto/ec/ec_lib.c:305:9: Taking false branch
303.                              const BIGNUM *order, const BIGNUM *cofactor)
304.   {
305.       if (generator == NULL) {
               ^
306.           ECerr(EC_F_EC_GROUP_SET_GENERATOR, ERR_R_PASSED_NULL_PARAMETER);
307.           return 0;

crypto/ec/ec_lib.c:310:9: Taking true branch
308.       }
309.   
310.       if (group->generator == NULL) {
               ^
311.           group->generator = EC_POINT_new(group);
312.           if (group->generator == NULL)

crypto/ec/ec_lib.c:311:9: 
309.   
310.       if (group->generator == NULL) {
311. >         group->generator = EC_POINT_new(group);
312.           if (group->generator == NULL)
313.               return 0;

crypto/ec/ec_lib.c:584:1: start of procedure EC_POINT_new()
  582.   /* functions for EC_POINT objects */
  583.   
  584. > EC_POINT *EC_POINT_new(const EC_GROUP *group)
  585.   {
  586.       EC_POINT *ret;

crypto/ec/ec_lib.c:588:9: Taking false branch
  586.       EC_POINT *ret;
  587.   
  588.       if (group == NULL) {
                 ^
  589.           ECerr(EC_F_EC_POINT_NEW, ERR_R_PASSED_NULL_PARAMETER);
  590.           return NULL;

crypto/ec/ec_lib.c:592:9: Taking false branch
  590.           return NULL;
  591.       }
  592.       if (group->meth->point_init == 0) {
                 ^
  593.           ECerr(EC_F_EC_POINT_NEW, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  594.           return NULL;

crypto/ec/ec_lib.c:597:5: 
  595.       }
  596.   
  597. >     ret = OPENSSL_zalloc(sizeof(*ret));
  598.       if (ret == NULL) {
  599.           ECerr(EC_F_EC_POINT_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/ec/ec_lib.c:598:9: Taking false branch
  596.   
  597.       ret = OPENSSL_zalloc(sizeof(*ret));
  598.       if (ret == NULL) {
                 ^
  599.           ECerr(EC_F_EC_POINT_NEW, ERR_R_MALLOC_FAILURE);
  600.           return NULL;

crypto/ec/ec_lib.c:603:5: 
  601.       }
  602.   
  603. >     ret->meth = group->meth;
  604.   
  605.       if (!ret->meth->point_init(ret)) {

crypto/ec/ec_lib.c:605:10: Taking false branch
  603.       ret->meth = group->meth;
  604.   
  605.       if (!ret->meth->point_init(ret)) {
                  ^
  606.           OPENSSL_free(ret);
  607.           return NULL;

crypto/ec/ec_lib.c:610:5: 
  608.       }
  609.   
  610. >     return ret;
  611.   }
  612.   

crypto/ec/ec_lib.c:611:1: return from a call to EC_POINT_new
  609.   
  610.       return ret;
  611. > }
  612.   
  613.   void EC_POINT_free(EC_POINT *point)

crypto/ec/ec_lib.c:312:13: Taking false branch
310.       if (group->generator == NULL) {
311.           group->generator = EC_POINT_new(group);
312.           if (group->generator == NULL)
                   ^
313.               return 0;
314.       }

crypto/ec/ec_lib.c:315:10: 
313.               return 0;
314.       }
315. >     if (!EC_POINT_copy(group->generator, generator))
316.           return 0;
317.   

crypto/ec/ec_lib.c:635:1: start of procedure EC_POINT_copy()
  633.   }
  634.   
  635. > int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src)
  636.   {
  637.       if (dest->meth->point_copy == 0) {

crypto/ec/ec_lib.c:637:9: Taking false branch
  635.   int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src)
  636.   {
  637.       if (dest->meth->point_copy == 0) {
                 ^
  638.           ECerr(EC_F_EC_POINT_COPY, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  639.           return 0;

crypto/ec/ec_lib.c:641:9: Taking false branch
  639.           return 0;
  640.       }
  641.       if (dest->meth != src->meth) {
                 ^
  642.           ECerr(EC_F_EC_POINT_COPY, EC_R_INCOMPATIBLE_OBJECTS);
  643.           return 0;

crypto/ec/ec_lib.c:645:9: Taking false branch
  643.           return 0;
  644.       }
  645.       if (dest == src)
                 ^
  646.           return 1;
  647.       return dest->meth->point_copy(dest, src);

crypto/ec/ec_lib.c:647:5: Skipping __function_pointer__(): unresolved function pointer
  645.       if (dest == src)
  646.           return 1;
  647.       return dest->meth->point_copy(dest, src);
             ^
  648.   }
  649.   

crypto/ec/ec_lib.c:648:1: return from a call to EC_POINT_copy
  646.           return 1;
  647.       return dest->meth->point_copy(dest, src);
  648. > }
  649.   
  650.   EC_POINT *EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group)

crypto/ec/ec_lib.c:315:10: Taking false branch
313.               return 0;
314.       }
315.       if (!EC_POINT_copy(group->generator, generator))
                ^
316.           return 0;
317.   

crypto/ec/ec_lib.c:318:9: Taking false branch
316.           return 0;
317.   
318.       if (order != NULL) {
               ^
319.           if (!BN_copy(group->order, order))
320.               return 0;

crypto/ec/ec_lib.c:322:9: 
320.               return 0;
321.       } else
322. >         BN_zero(group->order);
323.   
324.       if (cofactor != NULL) {

crypto/bn/bn_lib.c:520:1: start of procedure BN_set_word()
  518.   }
  519.   
  520. > int BN_set_word(BIGNUM *a, BN_ULONG w)
  521.   {
  522.       bn_check_top(a);

crypto/bn/bn_lib.c:523:9: Condition is true
  521.   {
  522.       bn_check_top(a);
  523.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  524.           return (0);
  525.       a->neg = 0;

crypto/bn/bn_lib.c:523:9: Taking false branch
  521.   {
  522.       bn_check_top(a);
  523.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  524.           return (0);
  525.       a->neg = 0;

crypto/bn/bn_lib.c:525:5: 
  523.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
  524.           return (0);
  525. >     a->neg = 0;
  526.       a->d[0] = w;
  527.       a->top = (w ? 1 : 0);

crypto/bn/bn_lib.c:526:5: 
  524.           return (0);
  525.       a->neg = 0;
  526. >     a->d[0] = w;
  527.       a->top = (w ? 1 : 0);
  528.       bn_check_top(a);

crypto/bn/bn_lib.c:527:15: Condition is false
  525.       a->neg = 0;
  526.       a->d[0] = w;
  527.       a->top = (w ? 1 : 0);
                       ^
  528.       bn_check_top(a);
  529.       return (1);

crypto/bn/bn_lib.c:527:5: 
  525.       a->neg = 0;
  526.       a->d[0] = w;
  527. >     a->top = (w ? 1 : 0);
  528.       bn_check_top(a);
  529.       return (1);

crypto/bn/bn_lib.c:529:5: 
  527.       a->top = (w ? 1 : 0);
  528.       bn_check_top(a);
  529. >     return (1);
  530.   }
  531.   

crypto/bn/bn_lib.c:530:1: return from a call to BN_set_word
  528.       bn_check_top(a);
  529.       return (1);
  530. > }
  531.   
  532.   BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)

crypto/ec/ec_lib.c:324:9: Taking false branch
322.           BN_zero(group->order);
323.   
324.       if (cofactor != NULL) {
               ^
325.           if (!BN_copy(group->cofactor, cofactor))
326.               return 0;

crypto/ec/ec_lib.c:328:9: 
326.               return 0;
327.       } else
328. >         BN_zero(group->cofactor);
329.   
330.       /*

crypto/bn/bn_lib.c:520:1: start of procedure BN_set_word()
  518.   }
  519.   
  520. > int BN_set_word(BIGNUM *a, BN_ULONG w)
  521.   {
  522.       bn_check_top(a);

crypto/bn/bn_lib.c:523:9: Condition is true
  521.   {
  522.       bn_check_top(a);
  523.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  524.           return (0);
  525.       a->neg = 0;

crypto/bn/bn_lib.c:523:9: Taking false branch
  521.   {
  522.       bn_check_top(a);
  523.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  524.           return (0);
  525.       a->neg = 0;

crypto/bn/bn_lib.c:525:5: 
  523.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
  524.           return (0);
  525. >     a->neg = 0;
  526.       a->d[0] = w;
  527.       a->top = (w ? 1 : 0);

crypto/bn/bn_lib.c:526:5: 
  524.           return (0);
  525.       a->neg = 0;
  526. >     a->d[0] = w;
  527.       a->top = (w ? 1 : 0);
  528.       bn_check_top(a);

crypto/bn/bn_lib.c:527:15: Condition is false
  525.       a->neg = 0;
  526.       a->d[0] = w;
  527.       a->top = (w ? 1 : 0);
                       ^
  528.       bn_check_top(a);
  529.       return (1);

crypto/bn/bn_lib.c:527:5: 
  525.       a->neg = 0;
  526.       a->d[0] = w;
  527. >     a->top = (w ? 1 : 0);
  528.       bn_check_top(a);
  529.       return (1);

crypto/bn/bn_lib.c:529:5: 
  527.       a->top = (w ? 1 : 0);
  528.       bn_check_top(a);
  529. >     return (1);
  530.   }
  531.   

crypto/bn/bn_lib.c:530:1: return from a call to BN_set_word
  528.       bn_check_top(a);
  529.       return (1);
  530. > }
  531.   
  532.   BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)

crypto/ec/ec_lib.c:335:5: Skipping ec_precompute_mont_data(): empty list of specs
333.        * |group->mont_data| will be NULL in this case.
334.        */
335.       ec_precompute_mont_data(group);
           ^
336.   
337.       return 1;

int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator,
                           const BIGNUM *order, const BIGNUM *cofactor)
{
    if (generator == NULL) {
        ECerr(EC_F_EC_GROUP_SET_GENERATOR, ERR_R_PASSED_NULL_PARAMETER);
        return 0;
    }
    if (group->generator == NULL) {
        group->generator = EC_POINT_new(group);
        if (group->generator == NULL)
            return 0;
    }
    if (!EC_POINT_copy(group->generator, generator))
        return 0;
    if (order != NULL) {
        if (!BN_copy(group->order, order))
            return 0;
    } else
        BN_zero(group->order);
    if (cofactor != NULL) {
        if (!BN_copy(group->cofactor, cofactor))
            return 0;
    } else
        BN_zero(group->cofactor);
    ec_precompute_mont_data(group);
    return 1;
}
['int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator,\n                           const BIGNUM *order, const BIGNUM *cofactor)\n{\n    if (generator == NULL) {\n        ECerr(EC_F_EC_GROUP_SET_GENERATOR, ERR_R_PASSED_NULL_PARAMETER);\n        return 0;\n    }\n    if (group->generator == NULL) {\n        group->generator = EC_POINT_new(group);\n        if (group->generator == NULL)\n            return 0;\n    }\n    if (!EC_POINT_copy(group->generator, generator))\n        return 0;\n    if (order != NULL) {\n        if (!BN_copy(group->order, order))\n            return 0;\n    } else\n        BN_zero(group->order);\n    if (cofactor != NULL) {\n        if (!BN_copy(group->cofactor, cofactor))\n            return 0;\n    } else\n        BN_zero(group->cofactor);\n    ec_precompute_mont_data(group);\n    return 1;\n}', 'EC_POINT *EC_POINT_new(const EC_GROUP *group)\n{\n    EC_POINT *ret;\n    if (group == NULL) {\n        ECerr(EC_F_EC_POINT_NEW, ERR_R_PASSED_NULL_PARAMETER);\n        return NULL;\n    }\n    if (group->meth->point_init == 0) {\n        ECerr(EC_F_EC_POINT_NEW, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);\n        return NULL;\n    }\n    ret = OPENSSL_zalloc(sizeof(*ret));\n    if (ret == NULL) {\n        ECerr(EC_F_EC_POINT_NEW, ERR_R_MALLOC_FAILURE);\n        return NULL;\n    }\n    ret->meth = group->meth;\n    if (!ret->meth->point_init(ret)) {\n        OPENSSL_free(ret);\n        return NULL;\n    }\n    return ret;\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}', '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}', 'int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src)\n{\n    if (dest->meth->point_copy == 0) {\n        ECerr(EC_F_EC_POINT_COPY, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);\n        return 0;\n    }\n    if (dest->meth != src->meth) {\n        ECerr(EC_F_EC_POINT_COPY, EC_R_INCOMPATIBLE_OBJECTS);\n        return 0;\n    }\n    if (dest == src)\n        return 1;\n    return dest->meth->point_copy(dest, src);\n}', 'int BN_set_word(BIGNUM *a, BN_ULONG w)\n{\n    bn_check_top(a);\n    if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)\n        return (0);\n    a->neg = 0;\n    a->d[0] = w;\n    a->top = (w ? 1 : 0);\n    bn_check_top(a);\n    return (1);\n}']