crypto/bio/bss_file.c:112: error: RESOURCE_LEAK
  resource of type `_IO_FILE` acquired by call to `fopen()` at line 102, column 12 is not released after line 112, column 2.
Showing all 60 steps of the trace


crypto/bio/bss_file.c:97:1: start of procedure BIO_new_file()
95.   	};
96.   
97. > BIO *BIO_new_file(const char *filename, const char *mode)
98.   	{
99.   	BIO *ret;

crypto/bio/bss_file.c:102:6: Taking false branch
100.   	FILE *file;
101.   
102.   	if ((file=fopen(filename,mode)) == NULL)
            ^
103.   		{
104.   		SYSerr(SYS_F_FOPEN,get_last_sys_error());

crypto/bio/bss_file.c:109:6: 
107.   		return(NULL);
108.   		}
109. > 	if ((ret=BIO_new(BIO_s_file_internal())) == NULL)
110.   		return(NULL);
111.   

crypto/bio/bss_file.c:127:1: start of procedure BIO_s_file()
  125.   	}
  126.   
  127. > BIO_METHOD *BIO_s_file(void)
  128.   	{
  129.   	return(&methods_filep);

crypto/bio/bss_file.c:129:2: 
  127.   BIO_METHOD *BIO_s_file(void)
  128.   	{
  129. > 	return(&methods_filep);
  130.   	}
  131.   

crypto/bio/bss_file.c:130:2: return from a call to BIO_s_file
  128.   	{
  129.   	return(&methods_filep);
  130.   	}
          ^
  131.   
  132.   static int MS_CALLBACK file_new(BIO *bi)

crypto/bio/bio_lib.c:69:1: start of procedure BIO_new()
  67.   static int bio_meth_num=0;
  68.   
  69. > BIO *BIO_new(BIO_METHOD *method)
  70.   	{
  71.   	BIO *ret=NULL;

crypto/bio/bio_lib.c:71:2: 
  69.   BIO *BIO_new(BIO_METHOD *method)
  70.   	{
  71. > 	BIO *ret=NULL;
  72.   
  73.   	ret=(BIO *)OPENSSL_malloc(sizeof(BIO));

crypto/bio/bio_lib.c:73:2: 
  71.   	BIO *ret=NULL;
  72.   
  73. > 	ret=(BIO *)OPENSSL_malloc(sizeof(BIO));
  74.   	if (ret == NULL)
  75.   		{

crypto/mem.c:205:1: start of procedure CRYPTO_malloc()
    203.   	}
    204.   
    205. > void *CRYPTO_malloc(int num, const char *file, int line)
    206.   	{
    207.   	void *ret = NULL;

crypto/mem.c:207:2: 
    205.   void *CRYPTO_malloc(int num, const char *file, int line)
    206.   	{
    207. > 	void *ret = NULL;
    208.   
    209.   	allow_customize = 0;

crypto/mem.c:209:2: 
    207.   	void *ret = NULL;
    208.   
    209. > 	allow_customize = 0;
    210.   	if (malloc_debug_func != NULL)
    211.   		{

crypto/mem.c:210:6: Taking false branch
    208.   
    209.   	allow_customize = 0;
    210.   	if (malloc_debug_func != NULL)
                ^
    211.   		{
    212.   		allow_customize_debug = 0;

crypto/mem.c:215:2: Skipping __function_pointer__(): unresolved function pointer
    213.   		malloc_debug_func(NULL, num, file, line, 0);
    214.   		}
    215.   	ret = malloc_func(num);
            ^
    216.   #ifdef LEVITTE_DEBUG
    217.   	fprintf(stderr, "LEVITTE_DEBUG:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:219:6: Taking false branch
    217.   	fprintf(stderr, "LEVITTE_DEBUG:         > 0x%p (%d)\n", ret, num);
    218.   #endif
    219.   	if (malloc_debug_func != NULL)
                ^
    220.   		malloc_debug_func(ret, num, file, line, 1);
    221.   

crypto/mem.c:222:2: 
    220.   		malloc_debug_func(ret, num, file, line, 1);
    221.   
    222. > 	return ret;
    223.   	}
    224.   

crypto/mem.c:223:2: return from a call to CRYPTO_malloc
    221.   
    222.   	return ret;
    223.   	}
            ^
    224.   
    225.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/bio/bio_lib.c:74:6: Taking false branch
  72.   
  73.   	ret=(BIO *)OPENSSL_malloc(sizeof(BIO));
  74.   	if (ret == NULL)
             ^
  75.   		{
  76.   		BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);

crypto/bio/bio_lib.c:79:7: 
  77.   		return(NULL);
  78.   		}
  79. > 	if (!BIO_set(ret,method))
  80.   		{
  81.   		OPENSSL_free(ret);

crypto/bio/bio_lib.c:87:1: start of procedure BIO_set()
    85.   	}
    86.   
    87. > int BIO_set(BIO *bio, BIO_METHOD *method)
    88.   	{
    89.   	bio->method=method;

crypto/bio/bio_lib.c:89:2: 
    87.   int BIO_set(BIO *bio, BIO_METHOD *method)
    88.   	{
    89. > 	bio->method=method;
    90.   	bio->callback=NULL;
    91.   	bio->cb_arg=NULL;

crypto/bio/bio_lib.c:90:2: 
    88.   	{
    89.   	bio->method=method;
    90. > 	bio->callback=NULL;
    91.   	bio->cb_arg=NULL;
    92.   	bio->init=0;

crypto/bio/bio_lib.c:91:2: 
    89.   	bio->method=method;
    90.   	bio->callback=NULL;
    91. > 	bio->cb_arg=NULL;
    92.   	bio->init=0;
    93.   	bio->shutdown=1;

crypto/bio/bio_lib.c:92:2: 
    90.   	bio->callback=NULL;
    91.   	bio->cb_arg=NULL;
    92. > 	bio->init=0;
    93.   	bio->shutdown=1;
    94.   	bio->flags=0;

crypto/bio/bio_lib.c:93:2: 
    91.   	bio->cb_arg=NULL;
    92.   	bio->init=0;
    93. > 	bio->shutdown=1;
    94.   	bio->flags=0;
    95.   	bio->retry_reason=0;

crypto/bio/bio_lib.c:94:2: 
    92.   	bio->init=0;
    93.   	bio->shutdown=1;
    94. > 	bio->flags=0;
    95.   	bio->retry_reason=0;
    96.   	bio->num=0;

crypto/bio/bio_lib.c:95:2: 
    93.   	bio->shutdown=1;
    94.   	bio->flags=0;
    95. > 	bio->retry_reason=0;
    96.   	bio->num=0;
    97.   	bio->ptr=NULL;

crypto/bio/bio_lib.c:96:2: 
    94.   	bio->flags=0;
    95.   	bio->retry_reason=0;
    96. > 	bio->num=0;
    97.   	bio->ptr=NULL;
    98.   	bio->prev_bio=NULL;

crypto/bio/bio_lib.c:97:2: 
    95.   	bio->retry_reason=0;
    96.   	bio->num=0;
    97. > 	bio->ptr=NULL;
    98.   	bio->prev_bio=NULL;
    99.   	bio->next_bio=NULL;

crypto/bio/bio_lib.c:98:2: 
    96.   	bio->num=0;
    97.   	bio->ptr=NULL;
    98. > 	bio->prev_bio=NULL;
    99.   	bio->next_bio=NULL;
    100.   	bio->references=1;

crypto/bio/bio_lib.c:99:2: 
    97.   	bio->ptr=NULL;
    98.   	bio->prev_bio=NULL;
    99. > 	bio->next_bio=NULL;
    100.   	bio->references=1;
    101.   	bio->num_read=0L;

crypto/bio/bio_lib.c:100:2: 
    98.   	bio->prev_bio=NULL;
    99.   	bio->next_bio=NULL;
    100. > 	bio->references=1;
    101.   	bio->num_read=0L;
    102.   	bio->num_write=0L;

crypto/bio/bio_lib.c:101:2: 
    99.   	bio->next_bio=NULL;
    100.   	bio->references=1;
    101. > 	bio->num_read=0L;
    102.   	bio->num_write=0L;
    103.   	CRYPTO_new_ex_data(bio_meth,bio,&bio->ex_data);

crypto/bio/bio_lib.c:102:2: 
    100.   	bio->references=1;
    101.   	bio->num_read=0L;
    102. > 	bio->num_write=0L;
    103.   	CRYPTO_new_ex_data(bio_meth,bio,&bio->ex_data);
    104.   	if (method->create != NULL)

crypto/bio/bio_lib.c:103:2: Skipping CRYPTO_new_ex_data(): empty list of specs
    101.   	bio->num_read=0L;
    102.   	bio->num_write=0L;
    103.   	CRYPTO_new_ex_data(bio_meth,bio,&bio->ex_data);
            ^
    104.   	if (method->create != NULL)
    105.   		if (!method->create(bio))

crypto/bio/bio_lib.c:104:6: Taking false branch
    102.   	bio->num_write=0L;
    103.   	CRYPTO_new_ex_data(bio_meth,bio,&bio->ex_data);
    104.   	if (method->create != NULL)
                ^
    105.   		if (!method->create(bio))
    106.   			return(0);

crypto/bio/bio_lib.c:107:2: 
    105.   		if (!method->create(bio))
    106.   			return(0);
    107. > 	return(1);
    108.   	}
    109.   

crypto/bio/bio_lib.c:108:2: return from a call to BIO_set
    106.   			return(0);
    107.   	return(1);
    108.   	}
            ^
    109.   
    110.   int BIO_free(BIO *a)

crypto/bio/bio_lib.c:79:7: Taking false branch
  77.   		return(NULL);
  78.   		}
  79.   	if (!BIO_set(ret,method))
              ^
  80.   		{
  81.   		OPENSSL_free(ret);

crypto/bio/bio_lib.c:84:2: 
  82.   		ret=NULL;
  83.   		}
  84. > 	return(ret);
  85.   	}
  86.   

crypto/bio/bio_lib.c:85:2: return from a call to BIO_new
  83.   		}
  84.   	return(ret);
  85.   	}
         ^
  86.   
  87.   int BIO_set(BIO *bio, BIO_METHOD *method)

crypto/bio/bss_file.c:109:6: Taking false branch
107.   		return(NULL);
108.   		}
109.   	if ((ret=BIO_new(BIO_s_file_internal())) == NULL)
            ^
110.   		return(NULL);
111.   

crypto/bio/bss_file.c:112:2: 
110.   		return(NULL);
111.   
112. > 	BIO_set_fp(ret,file,BIO_CLOSE);
113.   	return(ret);
114.   	}

crypto/bio/bio_lib.c:296:1: start of procedure BIO_ctrl()
  294.   	}
  295.   
  296. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
  297.   	{
  298.   	long ret;

crypto/bio/bio_lib.c:301:6: Taking false branch
  299.   	long (*cb)();
  300.   
  301.   	if (b == NULL) return(0);
              ^
  302.   
  303.   	if ((b->method == NULL) || (b->method->ctrl == NULL))

crypto/bio/bio_lib.c:303:7: Taking false branch
  301.   	if (b == NULL) return(0);
  302.   
  303.   	if ((b->method == NULL) || (b->method->ctrl == NULL))
               ^
  304.   		{
  305.   		BIOerr(BIO_F_BIO_CTRL,BIO_R_UNSUPPORTED_METHOD);

crypto/bio/bio_lib.c:303:30: Taking true branch
  301.   	if (b == NULL) return(0);
  302.   
  303.   	if ((b->method == NULL) || (b->method->ctrl == NULL))
                                      ^
  304.   		{
  305.   		BIOerr(BIO_F_BIO_CTRL,BIO_R_UNSUPPORTED_METHOD);

crypto/bio/bio_lib.c:305:3: 
  303.   	if ((b->method == NULL) || (b->method->ctrl == NULL))
  304.   		{
  305. > 		BIOerr(BIO_F_BIO_CTRL,BIO_R_UNSUPPORTED_METHOD);
  306.   		return(-2);
  307.   		}

crypto/err/err.c:353:1: start of procedure ERR_put_error()
    351.   /********************************************************/
    352.   
    353. > void ERR_put_error(int lib, int func, int reason, const char *file,
    354.   	     int line)
    355.   	{

crypto/err/err.c:377:2: Skipping ERR_get_state(): empty list of specs
    375.   	}
    376.   #endif
    377.   	es=ERR_get_state();
            ^
    378.   
    379.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:379:2: 
    377.   	es=ERR_get_state();
    378.   
    379. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    380.   	if (es->top == es->bottom)
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:380:6: Taking false branch
    378.   
    379.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    380.   	if (es->top == es->bottom)
                ^
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:382:2: 
    380.   	if (es->top == es->bottom)
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    382. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;

crypto/err/err.c:383:2: 
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    383. > 	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);

crypto/err/err.c:384:2: 
    382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    383.   	es->err_file[es->top]=file;
    384. > 	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
    386.   	}

crypto/err/err.c:385:2: Taking true branch
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
            ^
    386.   	}
    387.   

crypto/err/err.c:385:2: Taking false branch
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
            ^
    386.   	}
    387.   

crypto/err/err.c:386:2: return from a call to ERR_put_error
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
    386.   	}
            ^
    387.   
    388.   void ERR_clear_error(void)

crypto/bio/bio_lib.c:306:3: 
  304.   		{
  305.   		BIOerr(BIO_F_BIO_CTRL,BIO_R_UNSUPPORTED_METHOD);
  306. > 		return(-2);
  307.   		}
  308.   

crypto/bio/bio_lib.c:321:2: return from a call to BIO_ctrl
  319.   			larg,ret);
  320.   	return(ret);
  321.   	}
          ^
  322.   
  323.   long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long))

BIO *BIO_new_file(const char *filename, const char *mode)
	{
	BIO *ret;
	FILE *file;
	if ((file=fopen(filename,mode)) == NULL)
		{
		SYSerr(SYS_F_FOPEN,get_last_sys_error());
		ERR_add_error_data(5,"fopen('",filename,"','",mode,"')");
		BIOerr(BIO_F_BIO_NEW_FILE,ERR_R_SYS_LIB);
		return(NULL);
		}
	if ((ret=BIO_new(BIO_s_file_internal())) == NULL)
		return(NULL);
	BIO_set_fp(ret,file,BIO_CLOSE);
	return(ret);
	}
['BIO *BIO_new_file(const char *filename, const char *mode)\n\t{\n\tBIO *ret;\n\tFILE *file;\n\tif ((file=fopen(filename,mode)) == NULL)\n\t\t{\n\t\tSYSerr(SYS_F_FOPEN,get_last_sys_error());\n\t\tERR_add_error_data(5,"fopen(\'",filename,"\',\'",mode,"\')");\n\t\tBIOerr(BIO_F_BIO_NEW_FILE,ERR_R_SYS_LIB);\n\t\treturn(NULL);\n\t\t}\n\tif ((ret=BIO_new(BIO_s_file_internal())) == NULL)\n\t\treturn(NULL);\n\tBIO_set_fp(ret,file,BIO_CLOSE);\n\treturn(ret);\n\t}', 'BIO_METHOD *BIO_s_file(void)\n\t{\n\treturn(&methods_filep);\n\t}', 'BIO *BIO_new(BIO_METHOD *method)\n\t{\n\tBIO *ret=NULL;\n\tret=(BIO *)OPENSSL_malloc(sizeof(BIO));\n\tif (ret == NULL)\n\t\t{\n\t\tBIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);\n\t\treturn(NULL);\n\t\t}\n\tif (!BIO_set(ret,method))\n\t\t{\n\t\tOPENSSL_free(ret);\n\t\tret=NULL;\n\t\t}\n\treturn(ret);\n\t}', 'void *CRYPTO_malloc(int num, const char *file, int line)\n\t{\n\tvoid *ret = NULL;\n\tallow_customize = 0;\n\tif (malloc_debug_func != NULL)\n\t\t{\n\t\tallow_customize_debug = 0;\n\t\tmalloc_debug_func(NULL, num, file, line, 0);\n\t\t}\n\tret = malloc_func(num);\n#ifdef LEVITTE_DEBUG\n\tfprintf(stderr, "LEVITTE_DEBUG:         > 0x%p (%d)\\n", ret, num);\n#endif\n\tif (malloc_debug_func != NULL)\n\t\tmalloc_debug_func(ret, num, file, line, 1);\n\treturn ret;\n\t}', 'int BIO_set(BIO *bio, BIO_METHOD *method)\n\t{\n\tbio->method=method;\n\tbio->callback=NULL;\n\tbio->cb_arg=NULL;\n\tbio->init=0;\n\tbio->shutdown=1;\n\tbio->flags=0;\n\tbio->retry_reason=0;\n\tbio->num=0;\n\tbio->ptr=NULL;\n\tbio->prev_bio=NULL;\n\tbio->next_bio=NULL;\n\tbio->references=1;\n\tbio->num_read=0L;\n\tbio->num_write=0L;\n\tCRYPTO_new_ex_data(bio_meth,bio,&bio->ex_data);\n\tif (method->create != NULL)\n\t\tif (!method->create(bio))\n\t\t\treturn(0);\n\treturn(1);\n\t}', 'long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)\n\t{\n\tlong ret;\n\tlong (*cb)();\n\tif (b == NULL) return(0);\n\tif ((b->method == NULL) || (b->method->ctrl == NULL))\n\t\t{\n\t\tBIOerr(BIO_F_BIO_CTRL,BIO_R_UNSUPPORTED_METHOD);\n\t\treturn(-2);\n\t\t}\n\tcb=b->callback;\n\tif ((cb != NULL) &&\n\t\t((ret=cb(b,BIO_CB_CTRL,parg,cmd,larg,1L)) <= 0))\n\t\treturn(ret);\n\tret=b->method->ctrl(b,cmd,larg,parg);\n\tif (cb != NULL)\n\t\tret=cb(b,BIO_CB_CTRL|BIO_CB_RETURN,parg,cmd,\n\t\t\tlarg,ret);\n\treturn(ret);\n\t}', 'void ERR_put_error(int lib, int func, int reason, const char *file,\n\t     int line)\n\t{\n\tERR_STATE *es;\n#ifdef _OSD_POSIX\n\tif (strncmp(file,"*POSIX(", sizeof("*POSIX(")-1) == 0) {\n\t\tchar *end;\n\t\tfile += sizeof("*POSIX(")-1;\n\t\tend = &file[strlen(file)-1];\n\t\tif (*end == \')\')\n\t\t\t*end = \'\\0\';\n\t\tif ((end = strrchr(file, \'/\')) != NULL)\n\t\t\tfile = &end[1];\n\t}\n#endif\n\tes=ERR_get_state();\n\tes->top=(es->top+1)%ERR_NUM_ERRORS;\n\tif (es->top == es->bottom)\n\t\tes->bottom=(es->bottom+1)%ERR_NUM_ERRORS;\n\tes->err_buffer[es->top]=ERR_PACK(lib,func,reason);\n\tes->err_file[es->top]=file;\n\tes->err_line[es->top]=line;\n\terr_clear_data(es,es->top);\n\t}']