crypto/srp/srp_lib.c:171: error: MEMORY_LEAK
  memory dynamically allocated by call to `BN_new()` at line 158, column 16 is not reachable after line 171, column 5.
Showing all 125 steps of the trace


crypto/srp/srp_lib.c:148:1: start of procedure SRP_Calc_server_key()
146.   }
147.   
148. > BIGNUM *SRP_Calc_server_key(BIGNUM *A, BIGNUM *v, BIGNUM *u, BIGNUM *b,
149.                               BIGNUM *N)
150.   {

crypto/srp/srp_lib.c:151:5: 
149.                               BIGNUM *N)
150.   {
151. >     BIGNUM *tmp = NULL, *S = NULL;
152.       BN_CTX *bn_ctx;
153.   

crypto/srp/srp_lib.c:154:9: Taking false branch
152.       BN_CTX *bn_ctx;
153.   
154.       if (u == NULL || A == NULL || v == NULL || b == NULL || N == NULL)
               ^
155.           return NULL;
156.   

crypto/srp/srp_lib.c:154:22: Taking false branch
152.       BN_CTX *bn_ctx;
153.   
154.       if (u == NULL || A == NULL || v == NULL || b == NULL || N == NULL)
                            ^
155.           return NULL;
156.   

crypto/srp/srp_lib.c:154:35: Taking false branch
152.       BN_CTX *bn_ctx;
153.   
154.       if (u == NULL || A == NULL || v == NULL || b == NULL || N == NULL)
                                         ^
155.           return NULL;
156.   

crypto/srp/srp_lib.c:154:48: Taking false branch
152.       BN_CTX *bn_ctx;
153.   
154.       if (u == NULL || A == NULL || v == NULL || b == NULL || N == NULL)
                                                      ^
155.           return NULL;
156.   

crypto/srp/srp_lib.c:154:61: Taking false branch
152.       BN_CTX *bn_ctx;
153.   
154.       if (u == NULL || A == NULL || v == NULL || b == NULL || N == NULL)
                                                                   ^
155.           return NULL;
156.   

crypto/srp/srp_lib.c:157:9: 
155.           return NULL;
156.   
157. >     if ((bn_ctx = BN_CTX_new()) == NULL ||
158.           (tmp = BN_new()) == NULL || (S = BN_new()) == NULL)
159.           goto err;

crypto/bn/bn_ctx.c:189:1: start of procedure BN_CTX_new()
  187.   
  188.   
  189. > BN_CTX *BN_CTX_new(void)
  190.   {
  191.       BN_CTX *ret;

crypto/bn/bn_ctx.c:193:9: 
  191.       BN_CTX *ret;
  192.   
  193. >     if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
  194.           BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
  195.           return NULL;

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.   #ifdef 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)

crypto/bn/bn_ctx.c:193:9: Taking false branch
  191.       BN_CTX *ret;
  192.   
  193.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
                 ^
  194.           BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
  195.           return NULL;

crypto/bn/bn_ctx.c:198:5: 
  196.       }
  197.       /* Initialise the structure */
  198. >     BN_POOL_init(&ret->pool);
  199.       BN_STACK_init(&ret->stack);
  200.       return ret;

crypto/bn/bn_ctx.c:335:1: start of procedure BN_POOL_init()
    333.   /***********/
    334.   
    335. > static void BN_POOL_init(BN_POOL *p)
    336.   {
    337.       p->head = p->current = p->tail = NULL;

crypto/bn/bn_ctx.c:337:5: 
    335.   static void BN_POOL_init(BN_POOL *p)
    336.   {
    337. >     p->head = p->current = p->tail = NULL;
    338.       p->used = p->size = 0;
    339.   }

crypto/bn/bn_ctx.c:338:5: 
    336.   {
    337.       p->head = p->current = p->tail = NULL;
    338. >     p->used = p->size = 0;
    339.   }
    340.   

crypto/bn/bn_ctx.c:339:1: return from a call to BN_POOL_init
    337.       p->head = p->current = p->tail = NULL;
    338.       p->used = p->size = 0;
    339. > }
    340.   
    341.   static void BN_POOL_finish(BN_POOL *p)

crypto/bn/bn_ctx.c:199:5: 
  197.       /* Initialise the structure */
  198.       BN_POOL_init(&ret->pool);
  199. >     BN_STACK_init(&ret->stack);
  200.       return ret;
  201.   }

crypto/bn/bn_ctx.c:294:1: start of procedure BN_STACK_init()
    292.   /************/
    293.   
    294. > static void BN_STACK_init(BN_STACK *st)
    295.   {
    296.       st->indexes = NULL;

crypto/bn/bn_ctx.c:296:5: 
    294.   static void BN_STACK_init(BN_STACK *st)
    295.   {
    296. >     st->indexes = NULL;
    297.       st->depth = st->size = 0;
    298.   }

crypto/bn/bn_ctx.c:297:5: 
    295.   {
    296.       st->indexes = NULL;
    297. >     st->depth = st->size = 0;
    298.   }
    299.   

crypto/bn/bn_ctx.c:298:1: return from a call to BN_STACK_init
    296.       st->indexes = NULL;
    297.       st->depth = st->size = 0;
    298. > }
    299.   
    300.   static void BN_STACK_finish(BN_STACK *st)

crypto/bn/bn_ctx.c:200:5: 
  198.       BN_POOL_init(&ret->pool);
  199.       BN_STACK_init(&ret->stack);
  200. >     return ret;
  201.   }
  202.   

crypto/bn/bn_ctx.c:201:1: return from a call to BN_CTX_new
  199.       BN_STACK_init(&ret->stack);
  200.       return ret;
  201. > }
  202.   
  203.   BN_CTX *BN_CTX_secure_new(void)

crypto/srp/srp_lib.c:157:9: Taking false branch
155.           return NULL;
156.   
157.       if ((bn_ctx = BN_CTX_new()) == NULL ||
               ^
158.           (tmp = BN_new()) == NULL || (S = BN_new()) == NULL)
159.           goto err;

crypto/srp/srp_lib.c:158:9: 
156.   
157.       if ((bn_ctx = BN_CTX_new()) == NULL ||
158. >         (tmp = BN_new()) == NULL || (S = BN_new()) == NULL)
159.           goto err;
160.   

crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
  275.   }
  276.   
  277. > BIGNUM *BN_new(void)
  278.   {
  279.       BIGNUM *ret;

crypto/bn/bn_lib.c:281:9: 
  279.       BIGNUM *ret;
  280.   
  281. >     if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
  282.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  283.           return (NULL);

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.   #ifdef 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)

crypto/bn/bn_lib.c:281:9: Taking false branch
  279.       BIGNUM *ret;
  280.   
  281.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
                 ^
  282.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  283.           return (NULL);

crypto/bn/bn_lib.c:285:5: 
  283.           return (NULL);
  284.       }
  285. >     ret->flags = BN_FLG_MALLOCED;
  286.       bn_check_top(ret);
  287.       return (ret);

crypto/bn/bn_lib.c:287:5: 
  285.       ret->flags = BN_FLG_MALLOCED;
  286.       bn_check_top(ret);
  287. >     return (ret);
  288.   }
  289.   

crypto/bn/bn_lib.c:288:1: return from a call to BN_new
  286.       bn_check_top(ret);
  287.       return (ret);
  288. > }
  289.   
  290.    BIGNUM *BN_secure_new(void)

crypto/srp/srp_lib.c:158:9: Taking false branch
156.   
157.       if ((bn_ctx = BN_CTX_new()) == NULL ||
158.           (tmp = BN_new()) == NULL || (S = BN_new()) == NULL)
               ^
159.           goto err;
160.   

crypto/srp/srp_lib.c:158:37: 
156.   
157.       if ((bn_ctx = BN_CTX_new()) == NULL ||
158. >         (tmp = BN_new()) == NULL || (S = BN_new()) == NULL)
159.           goto err;
160.   

crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
  275.   }
  276.   
  277. > BIGNUM *BN_new(void)
  278.   {
  279.       BIGNUM *ret;

crypto/bn/bn_lib.c:281:9: 
  279.       BIGNUM *ret;
  280.   
  281. >     if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
  282.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  283.           return (NULL);

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.   #ifdef 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)

crypto/bn/bn_lib.c:281:9: Taking false branch
  279.       BIGNUM *ret;
  280.   
  281.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
                 ^
  282.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  283.           return (NULL);

crypto/bn/bn_lib.c:285:5: 
  283.           return (NULL);
  284.       }
  285. >     ret->flags = BN_FLG_MALLOCED;
  286.       bn_check_top(ret);
  287.       return (ret);

crypto/bn/bn_lib.c:287:5: 
  285.       ret->flags = BN_FLG_MALLOCED;
  286.       bn_check_top(ret);
  287. >     return (ret);
  288.   }
  289.   

crypto/bn/bn_lib.c:288:1: return from a call to BN_new
  286.       bn_check_top(ret);
  287.       return (ret);
  288. > }
  289.   
  290.    BIGNUM *BN_secure_new(void)

crypto/srp/srp_lib.c:158:37: Taking false branch
156.   
157.       if ((bn_ctx = BN_CTX_new()) == NULL ||
158.           (tmp = BN_new()) == NULL || (S = BN_new()) == NULL)
                                           ^
159.           goto err;
160.   

crypto/srp/srp_lib.c:163:10: Taking true branch
161.       /* S = (A*v**u) ** b */
162.   
163.       if (!BN_mod_exp(tmp, v, u, N, bn_ctx))
                ^
164.           goto err;
165.       if (!BN_mod_mul(tmp, A, tmp, N, bn_ctx))

crypto/srp/srp_lib.c:169:2: 
167.       if (!BN_mod_exp(S, tmp, b, N, bn_ctx))
168.           goto err;
169. >  err:
170.       BN_CTX_free(bn_ctx);
171.       BN_clear_free(tmp);

crypto/srp/srp_lib.c:170:5: 
168.           goto err;
169.    err:
170. >     BN_CTX_free(bn_ctx);
171.       BN_clear_free(tmp);
172.       return S;

crypto/bn/bn_ctx.c:212:1: start of procedure BN_CTX_free()
  210.   }
  211.   
  212. > void BN_CTX_free(BN_CTX *ctx)
  213.   {
  214.       if (ctx == NULL)

crypto/bn/bn_ctx.c:214:9: Taking false branch
  212.   void BN_CTX_free(BN_CTX *ctx)
  213.   {
  214.       if (ctx == NULL)
                 ^
  215.           return;
  216.   #ifdef BN_CTX_DEBUG

crypto/bn/bn_ctx.c:231:5: 
  229.       }
  230.   #endif
  231. >     BN_STACK_finish(&ctx->stack);
  232.       BN_POOL_finish(&ctx->pool);
  233.       OPENSSL_free(ctx);

crypto/bn/bn_ctx.c:300:1: start of procedure BN_STACK_finish()
    298.   }
    299.   
    300. > static void BN_STACK_finish(BN_STACK *st)
    301.   {
    302.       OPENSSL_free(st->indexes);

crypto/bn/bn_ctx.c:302:5: 
    300.   static void BN_STACK_finish(BN_STACK *st)
    301.   {
    302. >     OPENSSL_free(st->indexes);
    303.       st->indexes = NULL;
    304.   }

crypto/mem.c:234:1: start of procedure CRYPTO_free()
      232.   }
      233.   
      234. > void CRYPTO_free(void *str)
      235.   {
      236.   #ifdef 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/bn/bn_ctx.c:303:5: 
    301.   {
    302.       OPENSSL_free(st->indexes);
    303. >     st->indexes = NULL;
    304.   }
    305.   

crypto/bn/bn_ctx.c:304:1: return from a call to BN_STACK_finish
    302.       OPENSSL_free(st->indexes);
    303.       st->indexes = NULL;
    304. > }
    305.   
    306.   

crypto/bn/bn_ctx.c:232:5: 
  230.   #endif
  231.       BN_STACK_finish(&ctx->stack);
  232. >     BN_POOL_finish(&ctx->pool);
  233.       OPENSSL_free(ctx);
  234.   }

crypto/bn/bn_ctx.c:341:1: start of procedure BN_POOL_finish()
    339.   }
    340.   
    341. > static void BN_POOL_finish(BN_POOL *p)
    342.   {
    343.       unsigned int loop;

crypto/bn/bn_ctx.c:346:12: Loop condition is false. Leaving loop
    344.       BIGNUM *bn;
    345.   
    346.       while (p->head) {
                      ^
    347.           for (loop = 0, bn = p->head->vals; loop++ < BN_CTX_POOL_SIZE; bn++)
    348.               if (bn->d)

crypto/bn/bn_ctx.c:354:1: return from a call to BN_POOL_finish
    352.           p->head = p->current;
    353.       }
    354. > }
    355.   
    356.   

crypto/bn/bn_ctx.c:233:5: 
  231.       BN_STACK_finish(&ctx->stack);
  232.       BN_POOL_finish(&ctx->pool);
  233. >     OPENSSL_free(ctx);
  234.   }
  235.   

crypto/mem.c:234:1: start of procedure CRYPTO_free()
    232.   }
    233.   
    234. > void CRYPTO_free(void *str)
    235.   {
    236.   #ifdef 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/bn/bn_ctx.c:234:1: return from a call to BN_CTX_free
  232.       BN_POOL_finish(&ctx->pool);
  233.       OPENSSL_free(ctx);
  234. > }
  235.   
  236.   void BN_CTX_start(BN_CTX *ctx)

crypto/srp/srp_lib.c:171:5: 
169.    err:
170.       BN_CTX_free(bn_ctx);
171. >     BN_clear_free(tmp);
172.       return S;
173.   }

crypto/bn/bn_lib.c:234:1: start of procedure BN_clear_free()
  232.   
  233.   
  234. > void BN_clear_free(BIGNUM *a)
  235.   {
  236.       int i;

crypto/bn/bn_lib.c:238:9: Taking false branch
  236.       int i;
  237.   
  238.       if (a == NULL)
                 ^
  239.           return;
  240.       bn_check_top(a);

crypto/bn/bn_lib.c:241:9: Taking true branch
  239.           return;
  240.       bn_check_top(a);
  241.       if (a->d != NULL) {
                 ^
  242.           OPENSSL_cleanse(a->d, a->dmax * sizeof(a->d[0]));
  243.           if (!BN_get_flags(a, BN_FLG_STATIC_DATA))

crypto/bn/bn_lib.c:242:9: Skipping OPENSSL_cleanse(): method has no implementation
  240.       bn_check_top(a);
  241.       if (a->d != NULL) {
  242.           OPENSSL_cleanse(a->d, a->dmax * sizeof(a->d[0]));
                 ^
  243.           if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
  244.               bn_free_d(a);

crypto/bn/bn_lib.c:243:14: 
  241.       if (a->d != NULL) {
  242.           OPENSSL_cleanse(a->d, a->dmax * sizeof(a->d[0]));
  243. >         if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
  244.               bn_free_d(a);
  245.       }

crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
    963.   }
    964.   
    965. > int BN_get_flags(const BIGNUM *b, int n)
    966.   {
    967.       return b->flags & n;

crypto/bn/bn_lib.c:967:5: 
    965.   int BN_get_flags(const BIGNUM *b, int n)
    966.   {
    967. >     return b->flags & n;
    968.   }
    969.   

crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
    966.   {
    967.       return b->flags & n;
    968. > }
    969.   
    970.   /* Populate a BN_GENCB structure with an "old"-style callback */

crypto/bn/bn_lib.c:243:14: Taking false branch
  241.       if (a->d != NULL) {
  242.           OPENSSL_cleanse(a->d, a->dmax * sizeof(a->d[0]));
  243.           if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
                      ^
  244.               bn_free_d(a);
  245.       }

crypto/bn/bn_lib.c:246:5: 
  244.               bn_free_d(a);
  245.       }
  246. >     i = BN_get_flags(a, BN_FLG_MALLOCED);
  247.       OPENSSL_cleanse(a, sizeof(*a));
  248.       if (i)

crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
    963.   }
    964.   
    965. > int BN_get_flags(const BIGNUM *b, int n)
    966.   {
    967.       return b->flags & n;

crypto/bn/bn_lib.c:967:5: 
    965.   int BN_get_flags(const BIGNUM *b, int n)
    966.   {
    967. >     return b->flags & n;
    968.   }
    969.   

crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
    966.   {
    967.       return b->flags & n;
    968. > }
    969.   
    970.   /* Populate a BN_GENCB structure with an "old"-style callback */

crypto/bn/bn_lib.c:247:5: Skipping OPENSSL_cleanse(): method has no implementation
  245.       }
  246.       i = BN_get_flags(a, BN_FLG_MALLOCED);
  247.       OPENSSL_cleanse(a, sizeof(*a));
             ^
  248.       if (i)
  249.           OPENSSL_free(a);

crypto/bn/bn_lib.c:248:9: Taking false branch
  246.       i = BN_get_flags(a, BN_FLG_MALLOCED);
  247.       OPENSSL_cleanse(a, sizeof(*a));
  248.       if (i)
                 ^
  249.           OPENSSL_free(a);
  250.   }

crypto/bn/bn_lib.c:248:5: 
  246.       i = BN_get_flags(a, BN_FLG_MALLOCED);
  247.       OPENSSL_cleanse(a, sizeof(*a));
  248. >     if (i)
  249.           OPENSSL_free(a);
  250.   }

crypto/bn/bn_lib.c:250:1: return from a call to BN_clear_free
  248.       if (i)
  249.           OPENSSL_free(a);
  250. > }
  251.   
  252.   void BN_free(BIGNUM *a)

BIGNUM *SRP_Calc_server_key(BIGNUM *A, BIGNUM *v, BIGNUM *u, BIGNUM *b,
                            BIGNUM *N)
{
    BIGNUM *tmp = NULL, *S = NULL;
    BN_CTX *bn_ctx;
    if (u == NULL || A == NULL || v == NULL || b == NULL || N == NULL)
        return NULL;
    if ((bn_ctx = BN_CTX_new()) == NULL ||
        (tmp = BN_new()) == NULL || (S = BN_new()) == NULL)
        goto err;
    if (!BN_mod_exp(tmp, v, u, N, bn_ctx))
        goto err;
    if (!BN_mod_mul(tmp, A, tmp, N, bn_ctx))
        goto err;
    if (!BN_mod_exp(S, tmp, b, N, bn_ctx))
        goto err;
 err:
    BN_CTX_free(bn_ctx);
    BN_clear_free(tmp);
    return S;
}
['BIGNUM *SRP_Calc_server_key(BIGNUM *A, BIGNUM *v, BIGNUM *u, BIGNUM *b,\n                            BIGNUM *N)\n{\n    BIGNUM *tmp = NULL, *S = NULL;\n    BN_CTX *bn_ctx;\n    if (u == NULL || A == NULL || v == NULL || b == NULL || N == NULL)\n        return NULL;\n    if ((bn_ctx = BN_CTX_new()) == NULL ||\n        (tmp = BN_new()) == NULL || (S = BN_new()) == NULL)\n        goto err;\n    if (!BN_mod_exp(tmp, v, u, N, bn_ctx))\n        goto err;\n    if (!BN_mod_mul(tmp, A, tmp, N, bn_ctx))\n        goto err;\n    if (!BN_mod_exp(S, tmp, b, N, bn_ctx))\n        goto err;\n err:\n    BN_CTX_free(bn_ctx);\n    BN_clear_free(tmp);\n    return S;\n}', 'BN_CTX *BN_CTX_new(void)\n{\n    BN_CTX *ret;\n    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {\n        BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);\n        return NULL;\n    }\n    BN_POOL_init(&ret->pool);\n    BN_STACK_init(&ret->stack);\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#ifdef 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}', 'static void BN_POOL_init(BN_POOL *p)\n{\n    p->head = p->current = p->tail = NULL;\n    p->used = p->size = 0;\n}', 'static void BN_STACK_init(BN_STACK *st)\n{\n    st->indexes = NULL;\n    st->depth = st->size = 0;\n}', 'BIGNUM *BN_new(void)\n{\n    BIGNUM *ret;\n    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {\n        BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);\n        return (NULL);\n    }\n    ret->flags = BN_FLG_MALLOCED;\n    bn_check_top(ret);\n    return (ret);\n}', 'void BN_CTX_free(BN_CTX *ctx)\n{\n    if (ctx == NULL)\n        return;\n#ifdef BN_CTX_DEBUG\n    {\n        BN_POOL_ITEM *pool = ctx->pool.head;\n        fprintf(stderr, "BN_CTX_free, stack-size=%d, pool-bignums=%d\\n",\n                ctx->stack.size, ctx->pool.size);\n        fprintf(stderr, "dmaxs: ");\n        while (pool) {\n            unsigned loop = 0;\n            while (loop < BN_CTX_POOL_SIZE)\n                fprintf(stderr, "%02x ", pool->vals[loop++].dmax);\n            pool = pool->next;\n        }\n        fprintf(stderr, "\\n");\n    }\n#endif\n    BN_STACK_finish(&ctx->stack);\n    BN_POOL_finish(&ctx->pool);\n    OPENSSL_free(ctx);\n}', 'static void BN_STACK_finish(BN_STACK *st)\n{\n    OPENSSL_free(st->indexes);\n    st->indexes = NULL;\n}', 'void CRYPTO_free(void *str)\n{\n#ifdef CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_free(str, 0);\n        free(str);\n        CRYPTO_mem_debug_free(str, 1);\n    } else {\n        free(str);\n    }\n#else\n    free(str);\n#endif\n}', 'static void BN_POOL_finish(BN_POOL *p)\n{\n    unsigned int loop;\n    BIGNUM *bn;\n    while (p->head) {\n        for (loop = 0, bn = p->head->vals; loop++ < BN_CTX_POOL_SIZE; bn++)\n            if (bn->d)\n                BN_clear_free(bn);\n        p->current = p->head->next;\n        OPENSSL_free(p->head);\n        p->head = p->current;\n    }\n}', 'void BN_clear_free(BIGNUM *a)\n{\n    int i;\n    if (a == NULL)\n        return;\n    bn_check_top(a);\n    if (a->d != NULL) {\n        OPENSSL_cleanse(a->d, a->dmax * sizeof(a->d[0]));\n        if (!BN_get_flags(a, BN_FLG_STATIC_DATA))\n            bn_free_d(a);\n    }\n    i = BN_get_flags(a, BN_FLG_MALLOCED);\n    OPENSSL_cleanse(a, sizeof(*a));\n    if (i)\n        OPENSSL_free(a);\n}', 'int BN_get_flags(const BIGNUM *b, int n)\n{\n    return b->flags & n;\n}']