crypto/x509v3/v3_alt.c:172: error: MEMORY_LEAK
  memory dynamically allocated by call to `sk_GENERAL_NAME_new()` at line 164, column 14 is not reachable after line 172, column 8.
Showing all 35 steps of the trace


crypto/x509v3/v3_alt.c:158:1: start of procedure v2i_issuer_alt()
156.   }
157.   
158. > static STACK_OF(GENERAL_NAME) *v2i_issuer_alt(X509V3_EXT_METHOD *method,
159.   						 X509V3_CTX *ctx, STACK *nval)
160.   {

crypto/x509v3/v3_alt.c:161:2: 
159.   						 X509V3_CTX *ctx, STACK *nval)
160.   {
161. > 	STACK_OF(GENERAL_NAME) *gens = NULL;
162.   	CONF_VALUE *cnf;
163.   	int i;

crypto/x509v3/v3_alt.c:164:7: 
162.   	CONF_VALUE *cnf;
163.   	int i;
164. > 	if(!(gens = sk_GENERAL_NAME_new(NULL))) {
165.   		X509V3err(X509V3_F_V2I_GENERAL_NAMES,ERR_R_MALLOC_FAILURE);
166.   		return NULL;

crypto/x509v3/v3_genn.c:235:1: start of procedure sk_GENERAL_NAME_new()
  233.   }
  234.   
  235. > IMPLEMENT_STACK_OF(GENERAL_NAME)
  236.   IMPLEMENT_ASN1_SET_OF(GENERAL_NAME)
  237.   

crypto/stack/stack.c:112:1: start of procedure sk_new()
    110.   	}
    111.   
    112. > STACK *sk_new(int (*c)())
    113.   	{
    114.   	STACK *ret;

crypto/stack/stack.c:117:6: Taking false branch
    115.   	int i;
    116.   
    117.   	if ((ret=(STACK *)Malloc(sizeof(STACK))) == NULL)
                ^
    118.   		goto err0;
    119.   	if ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)

crypto/stack/stack.c:119:6: Taking false branch
    117.   	if ((ret=(STACK *)Malloc(sizeof(STACK))) == NULL)
    118.   		goto err0;
    119.   	if ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)
                ^
    120.   		goto err1;
    121.   	for (i=0; i<MIN_NODES; i++)

crypto/stack/stack.c:121:7: 
    119.   	if ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)
    120.   		goto err1;
    121. > 	for (i=0; i<MIN_NODES; i++)
    122.   		ret->data[i]=NULL;
    123.   	ret->comp=c;

crypto/stack/stack.c:121:12: Loop condition is true. Entering loop body
    119.   	if ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)
    120.   		goto err1;
    121.   	for (i=0; i<MIN_NODES; i++)
                      ^
    122.   		ret->data[i]=NULL;
    123.   	ret->comp=c;

crypto/stack/stack.c:122:3: 
    120.   		goto err1;
    121.   	for (i=0; i<MIN_NODES; i++)
    122. > 		ret->data[i]=NULL;
    123.   	ret->comp=c;
    124.   	ret->num_alloc=MIN_NODES;

crypto/stack/stack.c:121:25: 
    119.   	if ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)
    120.   		goto err1;
    121. > 	for (i=0; i<MIN_NODES; i++)
    122.   		ret->data[i]=NULL;
    123.   	ret->comp=c;

crypto/stack/stack.c:121:12: Loop condition is false. Leaving loop
    119.   	if ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)
    120.   		goto err1;
    121.   	for (i=0; i<MIN_NODES; i++)
                      ^
    122.   		ret->data[i]=NULL;
    123.   	ret->comp=c;

crypto/stack/stack.c:123:2: 
    121.   	for (i=0; i<MIN_NODES; i++)
    122.   		ret->data[i]=NULL;
    123. > 	ret->comp=c;
    124.   	ret->num_alloc=MIN_NODES;
    125.   	ret->num=0;

crypto/stack/stack.c:124:2: 
    122.   		ret->data[i]=NULL;
    123.   	ret->comp=c;
    124. > 	ret->num_alloc=MIN_NODES;
    125.   	ret->num=0;
    126.   	ret->sorted=0;

crypto/stack/stack.c:125:2: 
    123.   	ret->comp=c;
    124.   	ret->num_alloc=MIN_NODES;
    125. > 	ret->num=0;
    126.   	ret->sorted=0;
    127.   	return(ret);

crypto/stack/stack.c:126:2: 
    124.   	ret->num_alloc=MIN_NODES;
    125.   	ret->num=0;
    126. > 	ret->sorted=0;
    127.   	return(ret);
    128.   err1:

crypto/stack/stack.c:127:2: 
    125.   	ret->num=0;
    126.   	ret->sorted=0;
    127. > 	return(ret);
    128.   err1:
    129.   	Free((char *)ret);

crypto/stack/stack.c:132:2: return from a call to sk_new
    130.   err0:
    131.   	return(NULL);
    132.   	}
            ^
    133.   
    134.   int sk_insert(STACK *st, char *data, int loc)

crypto/x509v3/v3_genn.c:235:1: return from a call to sk_GENERAL_NAME_new
  233.   }
  234.   
  235. > IMPLEMENT_STACK_OF(GENERAL_NAME)
  236.   IMPLEMENT_ASN1_SET_OF(GENERAL_NAME)
  237.   

crypto/x509v3/v3_alt.c:164:7: Taking false branch
162.   	CONF_VALUE *cnf;
163.   	int i;
164.   	if(!(gens = sk_GENERAL_NAME_new(NULL))) {
             ^
165.   		X509V3err(X509V3_F_V2I_GENERAL_NAMES,ERR_R_MALLOC_FAILURE);
166.   		return NULL;

crypto/x509v3/v3_alt.c:168:6: 
166.   		return NULL;
167.   	}
168. > 	for(i = 0; i < sk_num(nval); i++) {
169.   		cnf = (CONF_VALUE *)sk_value(nval, i);
170.   		if(!name_cmp(cnf->name, "issuer") && cnf->value &&

crypto/x509v3/v3_alt.c:168:13: Loop condition is true. Entering loop body
166.   		return NULL;
167.   	}
168.   	for(i = 0; i < sk_num(nval); i++) {
                   ^
169.   		cnf = (CONF_VALUE *)sk_value(nval, i);
170.   		if(!name_cmp(cnf->name, "issuer") && cnf->value &&

crypto/x509v3/v3_alt.c:169:3: 
167.   	}
168.   	for(i = 0; i < sk_num(nval); i++) {
169. > 		cnf = (CONF_VALUE *)sk_value(nval, i);
170.   		if(!name_cmp(cnf->name, "issuer") && cnf->value &&
171.   						!strcmp(cnf->value, "copy")) {

crypto/x509v3/v3_alt.c:170:7: 
168.   	for(i = 0; i < sk_num(nval); i++) {
169.   		cnf = (CONF_VALUE *)sk_value(nval, i);
170. > 		if(!name_cmp(cnf->name, "issuer") && cnf->value &&
171.   						!strcmp(cnf->value, "copy")) {
172.   			if(!copy_issuer(ctx, gens)) goto err;

crypto/x509v3/v3_utl.c:406:1: start of procedure name_cmp()
  404.    */
  405.   
  406. > int name_cmp(const char *name, const char *cmp)
  407.   {
  408.   	int len, ret;

crypto/x509v3/v3_utl.c:410:2: 
  408.   	int len, ret;
  409.   	char c;
  410. > 	len = strlen(cmp);
  411.   	if((ret = strncmp(name, cmp, len))) return ret;
  412.   	c = name[len];

crypto/x509v3/v3_utl.c:411:6: Taking false branch
  409.   	char c;
  410.   	len = strlen(cmp);
  411.   	if((ret = strncmp(name, cmp, len))) return ret;
              ^
  412.   	c = name[len];
  413.   	if(!c || (c=='.')) return 0;

crypto/x509v3/v3_utl.c:412:2: 
  410.   	len = strlen(cmp);
  411.   	if((ret = strncmp(name, cmp, len))) return ret;
  412. > 	c = name[len];
  413.   	if(!c || (c=='.')) return 0;
  414.   	return 1;

crypto/x509v3/v3_utl.c:413:6: Taking true branch
  411.   	if((ret = strncmp(name, cmp, len))) return ret;
  412.   	c = name[len];
  413.   	if(!c || (c=='.')) return 0;
              ^
  414.   	return 1;
  415.   }

crypto/x509v3/v3_utl.c:413:21: 
  411.   	if((ret = strncmp(name, cmp, len))) return ret;
  412.   	c = name[len];
  413. > 	if(!c || (c=='.')) return 0;
  414.   	return 1;
  415.   }

crypto/x509v3/v3_utl.c:415:1: return from a call to name_cmp
  413.   	if(!c || (c=='.')) return 0;
  414.   	return 1;
  415. > }

crypto/x509v3/v3_alt.c:170:7: Taking true branch
168.   	for(i = 0; i < sk_num(nval); i++) {
169.   		cnf = (CONF_VALUE *)sk_value(nval, i);
170.   		if(!name_cmp(cnf->name, "issuer") && cnf->value &&
             ^
171.   						!strcmp(cnf->value, "copy")) {
172.   			if(!copy_issuer(ctx, gens)) goto err;

crypto/x509v3/v3_alt.c:170:40: Taking true branch
168.   	for(i = 0; i < sk_num(nval); i++) {
169.   		cnf = (CONF_VALUE *)sk_value(nval, i);
170.   		if(!name_cmp(cnf->name, "issuer") && cnf->value &&
                                              ^
171.   						!strcmp(cnf->value, "copy")) {
172.   			if(!copy_issuer(ctx, gens)) goto err;

crypto/x509v3/v3_alt.c:171:8: Taking true branch
169.   		cnf = (CONF_VALUE *)sk_value(nval, i);
170.   		if(!name_cmp(cnf->name, "issuer") && cnf->value &&
171.   						!strcmp(cnf->value, "copy")) {
              ^
172.   			if(!copy_issuer(ctx, gens)) goto err;
173.   		} else {

crypto/x509v3/v3_alt.c:172:8: Skipping copy_issuer(): empty list of specs
170.   		if(!name_cmp(cnf->name, "issuer") && cnf->value &&
171.   						!strcmp(cnf->value, "copy")) {
172.   			if(!copy_issuer(ctx, gens)) goto err;
              ^
173.   		} else {
174.   			GENERAL_NAME *gen;

static STACK_OF(GENERAL_NAME) *v2i_issuer_alt(X509V3_EXT_METHOD *method,
						 X509V3_CTX *ctx, STACK *nval)
{
	STACK_OF(GENERAL_NAME) *gens = NULL;
	CONF_VALUE *cnf;
	int i;
	if(!(gens = sk_GENERAL_NAME_new(NULL))) {
		X509V3err(X509V3_F_V2I_GENERAL_NAMES,ERR_R_MALLOC_FAILURE);
		return NULL;
	}
	for(i = 0; i < sk_num(nval); i++) {
		cnf = (CONF_VALUE *)sk_value(nval, i);
		if(!name_cmp(cnf->name, "issuer") && cnf->value &&
						!strcmp(cnf->value, "copy")) {
			if(!copy_issuer(ctx, gens)) goto err;
		} else {
			GENERAL_NAME *gen;
			if(!(gen = v2i_GENERAL_NAME(method, ctx, cnf)))
								 goto err;
			sk_GENERAL_NAME_push(gens, gen);
		}
	}
	return gens;
	err:
	sk_GENERAL_NAME_pop_free(gens, GENERAL_NAME_free);
	return NULL;
}
['static STACK_OF(GENERAL_NAME) *v2i_issuer_alt(X509V3_EXT_METHOD *method,\n\t\t\t\t\t\t X509V3_CTX *ctx, STACK *nval)\n{\n\tSTACK_OF(GENERAL_NAME) *gens = NULL;\n\tCONF_VALUE *cnf;\n\tint i;\n\tif(!(gens = sk_GENERAL_NAME_new(NULL))) {\n\t\tX509V3err(X509V3_F_V2I_GENERAL_NAMES,ERR_R_MALLOC_FAILURE);\n\t\treturn NULL;\n\t}\n\tfor(i = 0; i < sk_num(nval); i++) {\n\t\tcnf = (CONF_VALUE *)sk_value(nval, i);\n\t\tif(!name_cmp(cnf->name, "issuer") && cnf->value &&\n\t\t\t\t\t\t!strcmp(cnf->value, "copy")) {\n\t\t\tif(!copy_issuer(ctx, gens)) goto err;\n\t\t} else {\n\t\t\tGENERAL_NAME *gen;\n\t\t\tif(!(gen = v2i_GENERAL_NAME(method, ctx, cnf)))\n\t\t\t\t\t\t\t\t goto err;\n\t\t\tsk_GENERAL_NAME_push(gens, gen);\n\t\t}\n\t}\n\treturn gens;\n\terr:\n\tsk_GENERAL_NAME_pop_free(gens, GENERAL_NAME_free);\n\treturn NULL;\n}', 'IMPLEMENT_STACK_OF(GENERAL_NAME)', 'STACK *sk_new(int (*c)())\n\t{\n\tSTACK *ret;\n\tint i;\n\tif ((ret=(STACK *)Malloc(sizeof(STACK))) == NULL)\n\t\tgoto err0;\n\tif ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)\n\t\tgoto err1;\n\tfor (i=0; i<MIN_NODES; i++)\n\t\tret->data[i]=NULL;\n\tret->comp=c;\n\tret->num_alloc=MIN_NODES;\n\tret->num=0;\n\tret->sorted=0;\n\treturn(ret);\nerr1:\n\tFree((char *)ret);\nerr0:\n\treturn(NULL);\n\t}', "int name_cmp(const char *name, const char *cmp)\n{\n\tint len, ret;\n\tchar c;\n\tlen = strlen(cmp);\n\tif((ret = strncmp(name, cmp, len))) return ret;\n\tc = name[len];\n\tif(!c || (c=='.')) return 0;\n\treturn 1;\n}"]