crypto/dsa/dsa_asn1.c:57: error: MEMORY_LEAK
  memory dynamically allocated by call to `malloc()` at line 46, column 11 is not reachable after line 57, column 7.
Showing all 38 steps of the trace


crypto/dsa/dsa_asn1.c:32:1: start of procedure i2d_DSA_SIG()
30.   }
31.   
32. > int i2d_DSA_SIG(DSA_SIG *v, unsigned char **pp)
33.   {
34.   	int t=0,len;

crypto/dsa/dsa_asn1.c:34:2: 
32.   int i2d_DSA_SIG(DSA_SIG *v, unsigned char **pp)
33.   {
34. > 	int t=0,len;
35.   	ASN1_INTEGER rbs,sbs;
36.   	unsigned char *p;

crypto/dsa/dsa_asn1.c:38:2: 
36.   	unsigned char *p;
37.   
38. > 	rbs.data=Malloc(BN_num_bits(v->r)/8+1);
39.   	if (rbs.data == NULL)
40.   		{

crypto/bn/bn_lib.c:238:1: start of procedure BN_num_bits()
  236.   	}
  237.   
  238. > int BN_num_bits(const BIGNUM *a)
  239.   	{
  240.   	BN_ULONG l;

crypto/bn/bn_lib.c:245:6: Taking true branch
  243.   	bn_check_top(a);
  244.   
  245.   	if (a->top == 0) return(0);
              ^
  246.   	l=a->d[a->top-1];
  247.   	i=(a->top-1)*BN_BITS2;

crypto/bn/bn_lib.c:245:19: 
  243.   	bn_check_top(a);
  244.   
  245. > 	if (a->top == 0) return(0);
  246.   	l=a->d[a->top-1];
  247.   	i=(a->top-1)*BN_BITS2;

crypto/bn/bn_lib.c:256:2: return from a call to BN_num_bits
  254.   		}
  255.   	return(i+BN_num_bits_word(l));
  256.   	}
          ^
  257.   
  258.   void BN_clear_free(BIGNUM *a)

crypto/dsa/dsa_asn1.c:39:6: Taking false branch
37.   
38.   	rbs.data=Malloc(BN_num_bits(v->r)/8+1);
39.   	if (rbs.data == NULL)
           ^
40.   		{
41.   		DSAerr(DSA_F_I2D_DSA_SIG, ERR_R_MALLOC_FAILURE);

crypto/dsa/dsa_asn1.c:44:2: 
42.   		return(0);
43.   		}
44. > 	rbs.type=V_ASN1_INTEGER;
45.   	rbs.length=BN_bn2bin(v->r,rbs.data);
46.   	sbs.data=Malloc(BN_num_bits(v->s)/8+1);

crypto/dsa/dsa_asn1.c:45:2: 
43.   		}
44.   	rbs.type=V_ASN1_INTEGER;
45. > 	rbs.length=BN_bn2bin(v->r,rbs.data);
46.   	sbs.data=Malloc(BN_num_bits(v->s)/8+1);
47.   	if (sbs.data == NULL)

crypto/bn/bn_lib.c:632:1: start of procedure BN_bn2bin()
  630.   
  631.   /* ignore negative */
  632. > int BN_bn2bin(BIGNUM *a, unsigned char *to)
  633.   	{
  634.   	int n,i;

crypto/bn/bn_lib.c:637:2: 
  635.   	BN_ULONG l;
  636.   
  637. > 	n=i=BN_num_bytes(a);
  638.   	while (i-- > 0)
  639.   		{

crypto/bn/bn_lib.c:238:1: start of procedure BN_num_bits()
    236.   	}
    237.   
    238. > int BN_num_bits(const BIGNUM *a)
    239.   	{
    240.   	BN_ULONG l;

crypto/bn/bn_lib.c:245:6: Taking true branch
    243.   	bn_check_top(a);
    244.   
    245.   	if (a->top == 0) return(0);
                ^
    246.   	l=a->d[a->top-1];
    247.   	i=(a->top-1)*BN_BITS2;

crypto/bn/bn_lib.c:245:19: 
    243.   	bn_check_top(a);
    244.   
    245. > 	if (a->top == 0) return(0);
    246.   	l=a->d[a->top-1];
    247.   	i=(a->top-1)*BN_BITS2;

crypto/bn/bn_lib.c:256:2: return from a call to BN_num_bits
    254.   		}
    255.   	return(i+BN_num_bits_word(l));
    256.   	}
            ^
    257.   
    258.   void BN_clear_free(BIGNUM *a)

crypto/bn/bn_lib.c:638:9: Loop condition is false. Leaving loop
  636.   
  637.   	n=i=BN_num_bytes(a);
  638.   	while (i-- > 0)
                 ^
  639.   		{
  640.   		l=a->d[i/BN_BYTES];

crypto/bn/bn_lib.c:643:2: 
  641.   		*(to++)=(unsigned char)(l>>(8*(i%BN_BYTES)))&0xff;
  642.   		}
  643. > 	return(n);
  644.   	}
  645.   

crypto/bn/bn_lib.c:644:2: return from a call to BN_bn2bin
  642.   		}
  643.   	return(n);
  644.   	}
          ^
  645.   
  646.   int BN_ucmp(const BIGNUM *a, const BIGNUM *b)

crypto/dsa/dsa_asn1.c:46:2: 
44.   	rbs.type=V_ASN1_INTEGER;
45.   	rbs.length=BN_bn2bin(v->r,rbs.data);
46. > 	sbs.data=Malloc(BN_num_bits(v->s)/8+1);
47.   	if (sbs.data == NULL)
48.   		{

crypto/bn/bn_lib.c:238:1: start of procedure BN_num_bits()
  236.   	}
  237.   
  238. > int BN_num_bits(const BIGNUM *a)
  239.   	{
  240.   	BN_ULONG l;

crypto/bn/bn_lib.c:245:6: Taking true branch
  243.   	bn_check_top(a);
  244.   
  245.   	if (a->top == 0) return(0);
              ^
  246.   	l=a->d[a->top-1];
  247.   	i=(a->top-1)*BN_BITS2;

crypto/bn/bn_lib.c:245:19: 
  243.   	bn_check_top(a);
  244.   
  245. > 	if (a->top == 0) return(0);
  246.   	l=a->d[a->top-1];
  247.   	i=(a->top-1)*BN_BITS2;

crypto/bn/bn_lib.c:256:2: return from a call to BN_num_bits
  254.   		}
  255.   	return(i+BN_num_bits_word(l));
  256.   	}
          ^
  257.   
  258.   void BN_clear_free(BIGNUM *a)

crypto/dsa/dsa_asn1.c:47:6: Taking false branch
45.   	rbs.length=BN_bn2bin(v->r,rbs.data);
46.   	sbs.data=Malloc(BN_num_bits(v->s)/8+1);
47.   	if (sbs.data == NULL)
           ^
48.   		{
49.   		Free(rbs.data);

crypto/dsa/dsa_asn1.c:53:2: 
51.   		return(0);
52.   		}
53. > 	sbs.type=V_ASN1_INTEGER;
54.   	sbs.length=BN_bn2bin(v->s,sbs.data);
55.   

crypto/dsa/dsa_asn1.c:54:2: 
52.   		}
53.   	sbs.type=V_ASN1_INTEGER;
54. > 	sbs.length=BN_bn2bin(v->s,sbs.data);
55.   
56.   	len=i2d_ASN1_INTEGER(&rbs,NULL);

crypto/bn/bn_lib.c:632:1: start of procedure BN_bn2bin()
  630.   
  631.   /* ignore negative */
  632. > int BN_bn2bin(BIGNUM *a, unsigned char *to)
  633.   	{
  634.   	int n,i;

crypto/bn/bn_lib.c:637:2: 
  635.   	BN_ULONG l;
  636.   
  637. > 	n=i=BN_num_bytes(a);
  638.   	while (i-- > 0)
  639.   		{

crypto/bn/bn_lib.c:238:1: start of procedure BN_num_bits()
    236.   	}
    237.   
    238. > int BN_num_bits(const BIGNUM *a)
    239.   	{
    240.   	BN_ULONG l;

crypto/bn/bn_lib.c:245:6: Taking true branch
    243.   	bn_check_top(a);
    244.   
    245.   	if (a->top == 0) return(0);
                ^
    246.   	l=a->d[a->top-1];
    247.   	i=(a->top-1)*BN_BITS2;

crypto/bn/bn_lib.c:245:19: 
    243.   	bn_check_top(a);
    244.   
    245. > 	if (a->top == 0) return(0);
    246.   	l=a->d[a->top-1];
    247.   	i=(a->top-1)*BN_BITS2;

crypto/bn/bn_lib.c:256:2: return from a call to BN_num_bits
    254.   		}
    255.   	return(i+BN_num_bits_word(l));
    256.   	}
            ^
    257.   
    258.   void BN_clear_free(BIGNUM *a)

crypto/bn/bn_lib.c:638:9: Loop condition is false. Leaving loop
  636.   
  637.   	n=i=BN_num_bytes(a);
  638.   	while (i-- > 0)
                 ^
  639.   		{
  640.   		l=a->d[i/BN_BYTES];

crypto/bn/bn_lib.c:643:2: 
  641.   		*(to++)=(unsigned char)(l>>(8*(i%BN_BYTES)))&0xff;
  642.   		}
  643. > 	return(n);
  644.   	}
  645.   

crypto/bn/bn_lib.c:644:2: return from a call to BN_bn2bin
  642.   		}
  643.   	return(n);
  644.   	}
          ^
  645.   
  646.   int BN_ucmp(const BIGNUM *a, const BIGNUM *b)

crypto/dsa/dsa_asn1.c:56:2: Skipping i2d_ASN1_INTEGER(): empty list of specs
54.   	sbs.length=BN_bn2bin(v->s,sbs.data);
55.   
56.   	len=i2d_ASN1_INTEGER(&rbs,NULL);
       ^
57.   	len+=i2d_ASN1_INTEGER(&sbs,NULL);
58.   

crypto/dsa/dsa_asn1.c:57:2: Skipping i2d_ASN1_INTEGER(): empty list of specs
55.   
56.   	len=i2d_ASN1_INTEGER(&rbs,NULL);
57.   	len+=i2d_ASN1_INTEGER(&sbs,NULL);
       ^
58.   
59.   	if (pp)

int i2d_DSA_SIG(DSA_SIG *v, unsigned char **pp)
{
	int t=0,len;
	ASN1_INTEGER rbs,sbs;
	unsigned char *p;
	rbs.data=Malloc(BN_num_bits(v->r)/8+1);
	if (rbs.data == NULL)
		{
		DSAerr(DSA_F_I2D_DSA_SIG, ERR_R_MALLOC_FAILURE);
		return(0);
		}
	rbs.type=V_ASN1_INTEGER;
	rbs.length=BN_bn2bin(v->r,rbs.data);
	sbs.data=Malloc(BN_num_bits(v->s)/8+1);
	if (sbs.data == NULL)
		{
		Free(rbs.data);
		DSAerr(DSA_F_I2D_DSA_SIG, ERR_R_MALLOC_FAILURE);
		return(0);
		}
	sbs.type=V_ASN1_INTEGER;
	sbs.length=BN_bn2bin(v->s,sbs.data);
	len=i2d_ASN1_INTEGER(&rbs,NULL);
	len+=i2d_ASN1_INTEGER(&sbs,NULL);
	if (pp)
		{
		p=*pp;
		ASN1_put_object(&p,1,len,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
		i2d_ASN1_INTEGER(&rbs,&p);
		i2d_ASN1_INTEGER(&sbs,&p);
		}
	t=ASN1_object_size(1,len,V_ASN1_SEQUENCE);
	Free(rbs.data);
	Free(sbs.data);
	return(t);
}
['int i2d_DSA_SIG(DSA_SIG *v, unsigned char **pp)\n{\n\tint t=0,len;\n\tASN1_INTEGER rbs,sbs;\n\tunsigned char *p;\n\trbs.data=Malloc(BN_num_bits(v->r)/8+1);\n\tif (rbs.data == NULL)\n\t\t{\n\t\tDSAerr(DSA_F_I2D_DSA_SIG, ERR_R_MALLOC_FAILURE);\n\t\treturn(0);\n\t\t}\n\trbs.type=V_ASN1_INTEGER;\n\trbs.length=BN_bn2bin(v->r,rbs.data);\n\tsbs.data=Malloc(BN_num_bits(v->s)/8+1);\n\tif (sbs.data == NULL)\n\t\t{\n\t\tFree(rbs.data);\n\t\tDSAerr(DSA_F_I2D_DSA_SIG, ERR_R_MALLOC_FAILURE);\n\t\treturn(0);\n\t\t}\n\tsbs.type=V_ASN1_INTEGER;\n\tsbs.length=BN_bn2bin(v->s,sbs.data);\n\tlen=i2d_ASN1_INTEGER(&rbs,NULL);\n\tlen+=i2d_ASN1_INTEGER(&sbs,NULL);\n\tif (pp)\n\t\t{\n\t\tp=*pp;\n\t\tASN1_put_object(&p,1,len,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);\n\t\ti2d_ASN1_INTEGER(&rbs,&p);\n\t\ti2d_ASN1_INTEGER(&sbs,&p);\n\t\t}\n\tt=ASN1_object_size(1,len,V_ASN1_SEQUENCE);\n\tFree(rbs.data);\n\tFree(sbs.data);\n\treturn(t);\n}', 'int BN_num_bits(const BIGNUM *a)\n\t{\n\tBN_ULONG l;\n\tint i;\n\tbn_check_top(a);\n\tif (a->top == 0) return(0);\n\tl=a->d[a->top-1];\n\ti=(a->top-1)*BN_BITS2;\n\tif (l == 0)\n\t\t{\n#if !defined(NO_STDIO) && !defined(WIN16)\n\t\tfprintf(stderr,"BAD TOP VALUE\\n");\n#endif\n\t\tabort();\n\t\t}\n\treturn(i+BN_num_bits_word(l));\n\t}', 'int BN_bn2bin(BIGNUM *a, unsigned char *to)\n\t{\n\tint n,i;\n\tBN_ULONG l;\n\tn=i=BN_num_bytes(a);\n\twhile (i-- > 0)\n\t\t{\n\t\tl=a->d[i/BN_BYTES];\n\t\t*(to++)=(unsigned char)(l>>(8*(i%BN_BYTES)))&0xff;\n\t\t}\n\treturn(n);\n\t}']