crypto/srp/srp_vfy.c:516: error: MEMORY_LEAK
  memory dynamically allocated by call to `SRP_user_pwd_set_ids()` at line 497, column 10 is not reachable after line 516, column 5.
Showing all 89 steps of the trace


crypto/srp/srp_vfy.c:471:1: start of procedure SRP_VBASE_get_by_user()
469.   }
470.   
471. > SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)
472.   {
473.       int i;

crypto/srp/srp_vfy.c:477:5: 
475.       unsigned char digv[SHA_DIGEST_LENGTH];
476.       unsigned char digs[SHA_DIGEST_LENGTH];
477. >     EVP_MD_CTX *ctxt = NULL;
478.   
479.       if (vb == NULL)

crypto/srp/srp_vfy.c:479:9: Taking false branch
477.       EVP_MD_CTX *ctxt = NULL;
478.   
479.       if (vb == NULL)
               ^
480.           return NULL;
481.       for (i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++) {

crypto/srp/srp_vfy.c:481:10: 
479.       if (vb == NULL)
480.           return NULL;
481. >     for (i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++) {
482.           user = sk_SRP_user_pwd_value(vb->users_pwd, i);
483.           if (strcmp(user->id, username) == 0)

crypto/srp/srp_vfy.c:481:17: 
479.       if (vb == NULL)
480.           return NULL;
481. >     for (i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++) {
482.           user = sk_SRP_user_pwd_value(vb->users_pwd, i);
483.           if (strcmp(user->id, username) == 0)

include/openssl/srp.h:97:1: start of procedure sk_SRP_user_pwd_num()
  95.   } SRP_user_pwd;
  96.   
  97. > DEFINE_STACK_OF(SRP_user_pwd)
  98.   
  99.   typedef struct SRP_VBASE_st {

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

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

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

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

include/openssl/srp.h:97:1: return from a call to sk_SRP_user_pwd_num
  95.   } SRP_user_pwd;
  96.   
  97. > DEFINE_STACK_OF(SRP_user_pwd)
  98.   
  99.   typedef struct SRP_VBASE_st {

crypto/srp/srp_vfy.c:481:17: Loop condition is false. Leaving loop
479.       if (vb == NULL)
480.           return NULL;
481.       for (i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++) {
                       ^
482.           user = sk_SRP_user_pwd_value(vb->users_pwd, i);
483.           if (strcmp(user->id, username) == 0)

crypto/srp/srp_vfy.c:486:10: Taking false branch
484.               return user;
485.       }
486.       if ((vb->seed_key == NULL) ||
                ^
487.           (vb->default_g == NULL) || (vb->default_N == NULL))
488.           return NULL;

crypto/srp/srp_vfy.c:487:10: Taking false branch
485.       }
486.       if ((vb->seed_key == NULL) ||
487.           (vb->default_g == NULL) || (vb->default_N == NULL))
                ^
488.           return NULL;
489.   

crypto/srp/srp_vfy.c:487:37: Taking false branch
485.       }
486.       if ((vb->seed_key == NULL) ||
487.           (vb->default_g == NULL) || (vb->default_N == NULL))
                                           ^
488.           return NULL;
489.   

crypto/srp/srp_vfy.c:492:9: 
490.   /* if the user is unknown we set parameters as well if we have a seed_key */
491.   
492. >     if ((user = SRP_user_pwd_new()) == NULL)
493.           return NULL;
494.   

crypto/srp/srp_vfy.c:199:1: start of procedure SRP_user_pwd_new()
  197.   }
  198.   
  199. > static SRP_user_pwd *SRP_user_pwd_new(void)
  200.   {
  201.       SRP_user_pwd *ret = OPENSSL_malloc(sizeof(*ret));

crypto/srp/srp_vfy.c:201:5: 
  199.   static SRP_user_pwd *SRP_user_pwd_new(void)
  200.   {
  201. >     SRP_user_pwd *ret = OPENSSL_malloc(sizeof(*ret));
  202.       if (ret == NULL)
  203.           return 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/srp/srp_vfy.c:202:9: Taking false branch
  200.   {
  201.       SRP_user_pwd *ret = OPENSSL_malloc(sizeof(*ret));
  202.       if (ret == NULL)
                 ^
  203.           return NULL;
  204.       ret->N = NULL;

crypto/srp/srp_vfy.c:204:5: 
  202.       if (ret == NULL)
  203.           return NULL;
  204. >     ret->N = NULL;
  205.       ret->g = NULL;
  206.       ret->s = NULL;

crypto/srp/srp_vfy.c:205:5: 
  203.           return NULL;
  204.       ret->N = NULL;
  205. >     ret->g = NULL;
  206.       ret->s = NULL;
  207.       ret->v = NULL;

crypto/srp/srp_vfy.c:206:5: 
  204.       ret->N = NULL;
  205.       ret->g = NULL;
  206. >     ret->s = NULL;
  207.       ret->v = NULL;
  208.       ret->id = NULL;

crypto/srp/srp_vfy.c:207:5: 
  205.       ret->g = NULL;
  206.       ret->s = NULL;
  207. >     ret->v = NULL;
  208.       ret->id = NULL;
  209.       ret->info = NULL;

crypto/srp/srp_vfy.c:208:5: 
  206.       ret->s = NULL;
  207.       ret->v = NULL;
  208. >     ret->id = NULL;
  209.       ret->info = NULL;
  210.       return ret;

crypto/srp/srp_vfy.c:209:5: 
  207.       ret->v = NULL;
  208.       ret->id = NULL;
  209. >     ret->info = NULL;
  210.       return ret;
  211.   }

crypto/srp/srp_vfy.c:210:5: 
  208.       ret->id = NULL;
  209.       ret->info = NULL;
  210. >     return ret;
  211.   }
  212.   

crypto/srp/srp_vfy.c:211:1: return from a call to SRP_user_pwd_new
  209.       ret->info = NULL;
  210.       return ret;
  211. > }
  212.   
  213.   static void SRP_user_pwd_set_gN(SRP_user_pwd *vinfo, const BIGNUM *g,

crypto/srp/srp_vfy.c:492:9: Taking false branch
490.   /* if the user is unknown we set parameters as well if we have a seed_key */
491.   
492.       if ((user = SRP_user_pwd_new()) == NULL)
               ^
493.           return NULL;
494.   

crypto/srp/srp_vfy.c:495:5: 
493.           return NULL;
494.   
495. >     SRP_user_pwd_set_gN(user, vb->default_g, vb->default_N);
496.   
497.       if (!SRP_user_pwd_set_ids(user, username, NULL))

crypto/srp/srp_vfy.c:213:1: start of procedure SRP_user_pwd_set_gN()
  211.   }
  212.   
  213. > static void SRP_user_pwd_set_gN(SRP_user_pwd *vinfo, const BIGNUM *g,
  214.                                   const BIGNUM *N)
  215.   {

crypto/srp/srp_vfy.c:216:5: 
  214.                                   const BIGNUM *N)
  215.   {
  216. >     vinfo->N = N;
  217.       vinfo->g = g;
  218.   }

crypto/srp/srp_vfy.c:217:5: 
  215.   {
  216.       vinfo->N = N;
  217. >     vinfo->g = g;
  218.   }
  219.   

crypto/srp/srp_vfy.c:218:1: return from a call to SRP_user_pwd_set_gN
  216.       vinfo->N = N;
  217.       vinfo->g = g;
  218. > }
  219.   
  220.   static int SRP_user_pwd_set_ids(SRP_user_pwd *vinfo, const char *id,

crypto/srp/srp_vfy.c:497:10: 
495.       SRP_user_pwd_set_gN(user, vb->default_g, vb->default_N);
496.   
497. >     if (!SRP_user_pwd_set_ids(user, username, NULL))
498.           goto err;
499.   

crypto/srp/srp_vfy.c:220:1: start of procedure SRP_user_pwd_set_ids()
  218.   }
  219.   
  220. > static int SRP_user_pwd_set_ids(SRP_user_pwd *vinfo, const char *id,
  221.                                   const char *info)
  222.   {

crypto/srp/srp_vfy.c:223:9: Taking true branch
  221.                                   const char *info)
  222.   {
  223.       if (id != NULL && NULL == (vinfo->id = OPENSSL_strdup(id)))
                 ^
  224.           return 0;
  225.       return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));

crypto/srp/srp_vfy.c:223:23: 
  221.                                   const char *info)
  222.   {
  223. >     if (id != NULL && NULL == (vinfo->id = OPENSSL_strdup(id)))
  224.           return 0;
  225.       return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));

crypto/o_str.c:121:1: start of procedure CRYPTO_strdup()
    119.   }
    120.   
    121. > char *CRYPTO_strdup(const char *str, const char* file, int line)
    122.   {
    123.       char *ret;

crypto/o_str.c:125:9: Taking false branch
    123.       char *ret;
    124.   
    125.       if (str == NULL)
                   ^
    126.           return NULL;
    127.       ret = CRYPTO_malloc(strlen(str) + 1, file, line);

crypto/o_str.c:127:5: 
    125.       if (str == NULL)
    126.           return NULL;
    127. >     ret = CRYPTO_malloc(strlen(str) + 1, file, line);
    128.       if (ret != NULL)
    129.           strcpy(ret, str);

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/o_str.c:128:9: Taking true branch
    126.           return NULL;
    127.       ret = CRYPTO_malloc(strlen(str) + 1, file, line);
    128.       if (ret != NULL)
                   ^
    129.           strcpy(ret, str);
    130.       return ret;

crypto/o_str.c:129:9: 
    127.       ret = CRYPTO_malloc(strlen(str) + 1, file, line);
    128.       if (ret != NULL)
    129. >         strcpy(ret, str);
    130.       return ret;
    131.   }

crypto/o_str.c:130:5: 
    128.       if (ret != NULL)
    129.           strcpy(ret, str);
    130. >     return ret;
    131.   }
    132.   

crypto/o_str.c:131:1: return from a call to CRYPTO_strdup
    129.           strcpy(ret, str);
    130.       return ret;
    131. > }
    132.   
    133.   char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)

crypto/srp/srp_vfy.c:223:23: Taking false branch
  221.                                   const char *info)
  222.   {
  223.       if (id != NULL && NULL == (vinfo->id = OPENSSL_strdup(id)))
                               ^
  224.           return 0;
  225.       return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));

crypto/srp/srp_vfy.c:225:13: Condition is true
  223.       if (id != NULL && NULL == (vinfo->id = OPENSSL_strdup(id)))
  224.           return 0;
  225.       return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));
                     ^
  226.   }
  227.   

crypto/srp/srp_vfy.c:225:5: 
  223.       if (id != NULL && NULL == (vinfo->id = OPENSSL_strdup(id)))
  224.           return 0;
  225. >     return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));
  226.   }
  227.   

crypto/srp/srp_vfy.c:226:1: return from a call to SRP_user_pwd_set_ids
  224.           return 0;
  225.       return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));
  226. > }
  227.   
  228.   static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,

crypto/srp/srp_vfy.c:497:10: Taking false branch
495.       SRP_user_pwd_set_gN(user, vb->default_g, vb->default_N);
496.   
497.       if (!SRP_user_pwd_set_ids(user, username, NULL))
                ^
498.           goto err;
499.   

crypto/srp/srp_vfy.c:500:9: 
498.           goto err;
499.   
500. >     if (RAND_bytes(digv, SHA_DIGEST_LENGTH) <= 0)
501.           goto err;
502.       ctxt = EVP_MD_CTX_new();

crypto/rand/rand_lib.c:155:1: start of procedure RAND_bytes()
  153.   }
  154.   
  155. > int RAND_bytes(unsigned char *buf, int num)
  156.   {
  157.       const RAND_METHOD *meth = RAND_get_rand_method();

crypto/rand/rand_lib.c:157:5: 
  155.   int RAND_bytes(unsigned char *buf, int num)
  156.   {
  157. >     const RAND_METHOD *meth = RAND_get_rand_method();
  158.       if (meth && meth->bytes)
  159.           return meth->bytes(buf, num);

crypto/rand/rand_lib.c:92:1: start of procedure RAND_get_rand_method()
    90.   }
    91.   
    92. > const RAND_METHOD *RAND_get_rand_method(void)
    93.   {
    94.       if (!default_RAND_meth) {

crypto/rand/rand_lib.c:94:10: Taking false branch
    92.   const RAND_METHOD *RAND_get_rand_method(void)
    93.   {
    94.       if (!default_RAND_meth) {
                   ^
    95.   #ifndef OPENSSL_NO_ENGINE
    96.           ENGINE *e = ENGINE_get_default_RAND();

crypto/rand/rand_lib.c:110:5: 
    108.               default_RAND_meth = RAND_OpenSSL();
    109.       }
    110. >     return default_RAND_meth;
    111.   }
    112.   

crypto/rand/rand_lib.c:111:1: return from a call to RAND_get_rand_method
    109.       }
    110.       return default_RAND_meth;
    111. > }
    112.   
    113.   #ifndef OPENSSL_NO_ENGINE

crypto/rand/rand_lib.c:158:9: Taking true branch
  156.   {
  157.       const RAND_METHOD *meth = RAND_get_rand_method();
  158.       if (meth && meth->bytes)
                 ^
  159.           return meth->bytes(buf, num);
  160.       return (-1);

crypto/rand/rand_lib.c:158:17: Taking false branch
  156.   {
  157.       const RAND_METHOD *meth = RAND_get_rand_method();
  158.       if (meth && meth->bytes)
                         ^
  159.           return meth->bytes(buf, num);
  160.       return (-1);

crypto/rand/rand_lib.c:160:5: 
  158.       if (meth && meth->bytes)
  159.           return meth->bytes(buf, num);
  160. >     return (-1);
  161.   }
  162.   

crypto/rand/rand_lib.c:161:1: return from a call to RAND_bytes
  159.           return meth->bytes(buf, num);
  160.       return (-1);
  161. > }
  162.   
  163.   #if OPENSSL_API_COMPAT < 0x10100000L

crypto/srp/srp_vfy.c:500:9: Taking true branch
498.           goto err;
499.   
500.       if (RAND_bytes(digv, SHA_DIGEST_LENGTH) <= 0)
               ^
501.           goto err;
502.       ctxt = EVP_MD_CTX_new();

crypto/srp/srp_vfy.c:514:2: 
512.           return user;
513.   
514. >  err:
515.       EVP_MD_CTX_free(ctxt);
516.       SRP_user_pwd_free(user);

crypto/srp/srp_vfy.c:515:5: 
513.   
514.    err:
515. >     EVP_MD_CTX_free(ctxt);
516.       SRP_user_pwd_free(user);
517.       return NULL;

crypto/evp/digest.c:158:1: start of procedure EVP_MD_CTX_free()
  156.   }
  157.   
  158. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  159.   {
  160.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:160:5: Skipping EVP_MD_CTX_reset(): empty list of specs
  158.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  159.   {
  160.       EVP_MD_CTX_reset(ctx);
             ^
  161.       OPENSSL_free(ctx);
  162.   }

crypto/evp/digest.c:161:5: 
  159.   {
  160.       EVP_MD_CTX_reset(ctx);
  161. >     OPENSSL_free(ctx);
  162.   }
  163.   

crypto/mem.c:234:1: start of procedure CRYPTO_free()
    232.   }
    233.   
    234. > void CRYPTO_free(void *str)
    235.   {
    236.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:245:5: 
    243.       }
    244.   #else
    245. >     free(str);
    246.   #endif
    247.   }

crypto/mem.c:247:1: return from a call to CRYPTO_free
    245.       free(str);
    246.   #endif
    247. > }
    248.   
    249.   void CRYPTO_clear_free(void *str, size_t num)

crypto/evp/digest.c:162:1: return from a call to EVP_MD_CTX_free
  160.       EVP_MD_CTX_reset(ctx);
  161.       OPENSSL_free(ctx);
  162. > }
  163.   
  164.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)

crypto/srp/srp_vfy.c:516:5: Skipping SRP_user_pwd_free(): empty list of specs
514.    err:
515.       EVP_MD_CTX_free(ctxt);
516.       SRP_user_pwd_free(user);
           ^
517.       return NULL;
518.   }
