crypto/x509v3/v3_lib.c:127: error: MEMORY_LEAK
  memory dynamically allocated by call to `malloc()` at line 121, column 37 is not reachable after line 127, column 2.
Showing all 15 steps of the trace


crypto/x509v3/v3_lib.c:114:1: start of procedure X509V3_EXT_add_alias()
112.   }
113.   
114. > int X509V3_EXT_add_alias(int nid_to, int nid_from)
115.   {
116.   	X509V3_EXT_METHOD *ext, *tmpext;

crypto/x509v3/v3_lib.c:117:7: 
115.   {
116.   	X509V3_EXT_METHOD *ext, *tmpext;
117. > 	if(!(ext = X509V3_EXT_get_nid(nid_from))) {
118.   		X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,X509V3_R_EXTENSION_NOT_FOUND);
119.   		return 0;

crypto/x509v3/v3_lib.c:88:1: start of procedure X509V3_EXT_get_nid()
  86.   }
  87.   
  88. > X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid)
  89.   {
  90.   	X509V3_EXT_METHOD tmp;

crypto/x509v3/v3_lib.c:92:2: 
  90.   	X509V3_EXT_METHOD tmp;
  91.   	int idx;
  92. > 	tmp.ext_nid = nid;
  93.   	if(!ext_list || (tmp.ext_nid < 0) ) return NULL;
  94.   	idx = sk_find(ext_list, (char *)&tmp);

crypto/x509v3/v3_lib.c:93:6: Taking false branch
  91.   	int idx;
  92.   	tmp.ext_nid = nid;
  93.   	if(!ext_list || (tmp.ext_nid < 0) ) return NULL;
             ^
  94.   	idx = sk_find(ext_list, (char *)&tmp);
  95.   	if(idx == -1) return NULL;

crypto/x509v3/v3_lib.c:93:19: Taking false branch
  91.   	int idx;
  92.   	tmp.ext_nid = nid;
  93.   	if(!ext_list || (tmp.ext_nid < 0) ) return NULL;
                          ^
  94.   	idx = sk_find(ext_list, (char *)&tmp);
  95.   	if(idx == -1) return NULL;

crypto/x509v3/v3_lib.c:94:2: Skipping sk_find(): empty list of specs
  92.   	tmp.ext_nid = nid;
  93.   	if(!ext_list || (tmp.ext_nid < 0) ) return NULL;
  94.   	idx = sk_find(ext_list, (char *)&tmp);
         ^
  95.   	if(idx == -1) return NULL;
  96.   	return (X509V3_EXT_METHOD *)sk_value(ext_list, idx);

crypto/x509v3/v3_lib.c:95:5: Taking false branch
  93.   	if(!ext_list || (tmp.ext_nid < 0) ) return NULL;
  94.   	idx = sk_find(ext_list, (char *)&tmp);
  95.   	if(idx == -1) return NULL;
            ^
  96.   	return (X509V3_EXT_METHOD *)sk_value(ext_list, idx);
  97.   }

crypto/x509v3/v3_lib.c:96:2: 
  94.   	idx = sk_find(ext_list, (char *)&tmp);
  95.   	if(idx == -1) return NULL;
  96. > 	return (X509V3_EXT_METHOD *)sk_value(ext_list, idx);
  97.   }
  98.   

crypto/x509v3/v3_lib.c:97:1: return from a call to X509V3_EXT_get_nid
  95.   	if(idx == -1) return NULL;
  96.   	return (X509V3_EXT_METHOD *)sk_value(ext_list, idx);
  97. > }
  98.   
  99.   X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext)

crypto/x509v3/v3_lib.c:117:7: Taking false branch
115.   {
116.   	X509V3_EXT_METHOD *ext, *tmpext;
117.   	if(!(ext = X509V3_EXT_get_nid(nid_from))) {
             ^
118.   		X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,X509V3_R_EXTENSION_NOT_FOUND);
119.   		return 0;

crypto/x509v3/v3_lib.c:121:7: Taking false branch
119.   		return 0;
120.   	}
121.   	if(!(tmpext = (X509V3_EXT_METHOD *)Malloc(sizeof(X509V3_EXT_METHOD)))) {
             ^
122.   		X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,ERR_R_MALLOC_FAILURE);
123.   		return 0;

crypto/x509v3/v3_lib.c:125:2: 
123.   		return 0;
124.   	}
125. > 	*tmpext = *ext;
126.   	tmpext->ext_nid = nid_to;
127.   	tmpext->ext_flags |= X509V3_EXT_DYNAMIC;

crypto/x509v3/v3_lib.c:126:2: 
124.   	}
125.   	*tmpext = *ext;
126. > 	tmpext->ext_nid = nid_to;
127.   	tmpext->ext_flags |= X509V3_EXT_DYNAMIC;
128.   	return 1;

crypto/x509v3/v3_lib.c:127:2: 
125.   	*tmpext = *ext;
126.   	tmpext->ext_nid = nid_to;
127. > 	tmpext->ext_flags |= X509V3_EXT_DYNAMIC;
128.   	return 1;
129.   }

int X509V3_EXT_add_alias(int nid_to, int nid_from)
{
	X509V3_EXT_METHOD *ext, *tmpext;
	if(!(ext = X509V3_EXT_get_nid(nid_from))) {
		X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,X509V3_R_EXTENSION_NOT_FOUND);
		return 0;
	}
	if(!(tmpext = (X509V3_EXT_METHOD *)Malloc(sizeof(X509V3_EXT_METHOD)))) {
		X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,ERR_R_MALLOC_FAILURE);
		return 0;
	}
	*tmpext = *ext;
	tmpext->ext_nid = nid_to;
	tmpext->ext_flags |= X509V3_EXT_DYNAMIC;
	return 1;
}
['int X509V3_EXT_add_alias(int nid_to, int nid_from)\n{\n\tX509V3_EXT_METHOD *ext, *tmpext;\n\tif(!(ext = X509V3_EXT_get_nid(nid_from))) {\n\t\tX509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,X509V3_R_EXTENSION_NOT_FOUND);\n\t\treturn 0;\n\t}\n\tif(!(tmpext = (X509V3_EXT_METHOD *)Malloc(sizeof(X509V3_EXT_METHOD)))) {\n\t\tX509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,ERR_R_MALLOC_FAILURE);\n\t\treturn 0;\n\t}\n\t*tmpext = *ext;\n\ttmpext->ext_nid = nid_to;\n\ttmpext->ext_flags |= X509V3_EXT_DYNAMIC;\n\treturn 1;\n}', 'X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid)\n{\n\tX509V3_EXT_METHOD tmp;\n\tint idx;\n\ttmp.ext_nid = nid;\n\tif(!ext_list || (tmp.ext_nid < 0) ) return NULL;\n\tidx = sk_find(ext_list, (char *)&tmp);\n\tif(idx == -1) return NULL;\n\treturn (X509V3_EXT_METHOD *)sk_value(ext_list, idx);\n}']