ssl/ssl_cert.c:766: error: RESOURCE_LEAK
  resource acquired by call to `opendir()` at line 741, column 6 is not released after line 766, column 7.
Showing all 85 steps of the trace


ssl/ssl_cert.c:733:1: start of procedure SSL_add_dir_cert_subjects_to_stack()
731.   #ifndef MAC_OS_pre_X
732.   
733. > int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
734.   				       const char *dir)
735.   	{

ssl/ssl_cert.c:738:2: 
736.   	DIR *d;
737.   	struct dirent *dstruct;
738. > 	int ret = 0;
739.   
740.   	CRYPTO_w_lock(CRYPTO_LOCK_READDIR);

ssl/ssl_cert.c:740:2: 
738.   	int ret = 0;
739.   
740. > 	CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
741.   	d = opendir(dir);
742.   

crypto/cryptlib.c:374:1: start of procedure CRYPTO_lock()
  372.   	}
  373.   
  374. > void CRYPTO_lock(int mode, int type, const char *file, int line)
  375.   	{
  376.   #ifdef LOCK_DEBUG

crypto/cryptlib.c:399:6: Taking false branch
  397.   		}
  398.   #endif
  399.   	if (type < 0)
              ^
  400.   		{
  401.   		struct CRYPTO_dynlock_value *pointer

crypto/cryptlib.c:412:7: Taking true branch
  410.   		}
  411.   	else
  412.   		if (locking_callback != NULL)
               ^
  413.   			locking_callback(mode,type,file,line);
  414.   	}

crypto/cryptlib.c:413:4: Skipping __function_pointer__(): unresolved function pointer
  411.   	else
  412.   		if (locking_callback != NULL)
  413.   			locking_callback(mode,type,file,line);
            ^
  414.   	}
  415.   

crypto/cryptlib.c:399:2: 
  397.   		}
  398.   #endif
  399. > 	if (type < 0)
  400.   		{
  401.   		struct CRYPTO_dynlock_value *pointer

crypto/cryptlib.c:414:2: return from a call to CRYPTO_lock
  412.   		if (locking_callback != NULL)
  413.   			locking_callback(mode,type,file,line);
  414.   	}
          ^
  415.   
  416.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

ssl/ssl_cert.c:741:2: 
739.   
740.   	CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
741. > 	d = opendir(dir);
742.   
743.   	/* Note that a side effect is that the CAs will be sorted by name */

ssl/ssl_cert.c:744:6: Taking false branch
742.   
743.   	/* Note that a side effect is that the CAs will be sorted by name */
744.   	if(!d)
            ^
745.   		{
746.   		SYSerr(SYS_F_OPENDIR, get_last_sys_error());

ssl/ssl_cert.c:752:9: Loop condition is true. Entering loop body
750.   		}
751.   	
752.   	while((dstruct=readdir(d)))
               ^
753.   		{
754.   		char buf[1024];

ssl/ssl_cert.c:757:6: Taking false branch
755.   		int r;
756.   		
757.   		if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf)
            ^
758.   			{
759.   			SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG);

ssl/ssl_cert.c:763:3: Skipping BIO_snprintf(): empty list of specs
761.   			}
762.   		
763.   		r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name);
         ^
764.   		if (r <= 0 || r >= sizeof buf)
765.   			goto err;

ssl/ssl_cert.c:764:7: Taking false branch
762.   		
763.   		r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name);
764.   		if (r <= 0 || r >= sizeof buf)
             ^
765.   			goto err;
766.   		if(!SSL_add_file_cert_subjects_to_stack(stack,buf))

ssl/ssl_cert.c:764:17: Taking false branch
762.   		
763.   		r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name);
764.   		if (r <= 0 || r >= sizeof buf)
                       ^
765.   			goto err;
766.   		if(!SSL_add_file_cert_subjects_to_stack(stack,buf))

ssl/ssl_cert.c:766:7: 
764.   		if (r <= 0 || r >= sizeof buf)
765.   			goto err;
766. > 		if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
767.   			goto err;
768.   		}

ssl/ssl_cert.c:668:1: start of procedure SSL_add_file_cert_subjects_to_stack()
  666.    */
  667.   
  668. > int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
  669.   					const char *file)
  670.   	{

ssl/ssl_cert.c:672:2: 
  670.   	{
  671.   	BIO *in;
  672. > 	X509 *x=NULL;
  673.   	X509_NAME *xn=NULL;
  674.   	int ret=1;

ssl/ssl_cert.c:673:2: 
  671.   	BIO *in;
  672.   	X509 *x=NULL;
  673. > 	X509_NAME *xn=NULL;
  674.   	int ret=1;
  675.   	int (*oldcmp)(const X509_NAME * const *a, const X509_NAME * const *b);

ssl/ssl_cert.c:674:2: 
  672.   	X509 *x=NULL;
  673.   	X509_NAME *xn=NULL;
  674. > 	int ret=1;
  675.   	int (*oldcmp)(const X509_NAME * const *a, const X509_NAME * const *b);
  676.   	

ssl/ssl_cert.c:677:2: 
  675.   	int (*oldcmp)(const X509_NAME * const *a, const X509_NAME * const *b);
  676.   	
  677. > 	oldcmp=sk_X509_NAME_set_cmp_func(stack,xname_cmp);
  678.   	
  679.   	in=BIO_new(BIO_s_file_internal());

crypto/stack/stack.c:79:1: start of procedure sk_set_cmp_func()
    77.   #include <errno.h>
    78.   
    79. > int (*sk_set_cmp_func(STACK *sk, int (*c)(const char * const *,const char * const *)))
    80.   		(const char * const *, const char * const *)
    81.   	{

crypto/stack/stack.c:82:2: 
    80.   		(const char * const *, const char * const *)
    81.   	{
    82. > 	int (*old)(const char * const *,const char * const *)=sk->comp;
    83.   
    84.   	if (sk->comp != c)

crypto/stack/stack.c:84:6: Taking true branch
    82.   	int (*old)(const char * const *,const char * const *)=sk->comp;
    83.   
    84.   	if (sk->comp != c)
               ^
    85.   		sk->sorted=0;
    86.   	sk->comp=c;

crypto/stack/stack.c:85:3: 
    83.   
    84.   	if (sk->comp != c)
    85. > 		sk->sorted=0;
    86.   	sk->comp=c;
    87.   

crypto/stack/stack.c:86:2: 
    84.   	if (sk->comp != c)
    85.   		sk->sorted=0;
    86. > 	sk->comp=c;
    87.   
    88.   	return old;

crypto/stack/stack.c:88:2: 
    86.   	sk->comp=c;
    87.   
    88. > 	return old;
    89.   	}
    90.   

crypto/stack/stack.c:89:2: return from a call to sk_set_cmp_func
    87.   
    88.   	return old;
    89.   	}
           ^
    90.   
    91.   STACK *sk_dup(STACK *sk)

ssl/ssl_cert.c:679:2: 
  677.   	oldcmp=sk_X509_NAME_set_cmp_func(stack,xname_cmp);
  678.   	
  679. > 	in=BIO_new(BIO_s_file_internal());
  680.   	
  681.   	if (in == NULL)

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:66:1: start of procedure BIO_new()
    64.   #include <openssl/stack.h>
    65.   
    66. > BIO *BIO_new(BIO_METHOD *method)
    67.   	{
    68.   	BIO *ret=NULL;

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

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

crypto/mem.c:282:1: start of procedure CRYPTO_malloc()
      280.   	}
      281.   
      282. > void *CRYPTO_malloc(int num, const char *file, int line)
      283.   	{
      284.   	void *ret = NULL;

crypto/mem.c:284:2: 
      282.   void *CRYPTO_malloc(int num, const char *file, int line)
      283.   	{
      284. > 	void *ret = NULL;
      285.   
      286.   	allow_customize = 0;

crypto/mem.c:286:2: 
      284.   	void *ret = NULL;
      285.   
      286. > 	allow_customize = 0;
      287.   	if (malloc_debug_func != NULL)
      288.   		{

crypto/mem.c:287:6: Taking false branch
      285.   
      286.   	allow_customize = 0;
      287.   	if (malloc_debug_func != NULL)
                  ^
      288.   		{
      289.   		allow_customize_debug = 0;

crypto/mem.c:292:2: Skipping __function_pointer__(): unresolved function pointer
      290.   		malloc_debug_func(NULL, num, file, line, 0);
      291.   		}
      292.   	ret = malloc_ex_func(num,file,line);
              ^
      293.   #ifdef LEVITTE_DEBUG_MEM
      294.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:296:6: Taking false branch
      294.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
      295.   #endif
      296.   	if (malloc_debug_func != NULL)
                  ^
      297.   		malloc_debug_func(ret, num, file, line, 1);
      298.   

crypto/mem.c:299:2: 
      297.   		malloc_debug_func(ret, num, file, line, 1);
      298.   
      299. > 	return ret;
      300.   	}
      301.   

crypto/mem.c:300:2: return from a call to CRYPTO_malloc
      298.   
      299.   	return ret;
      300.   	}
              ^
      301.   
      302.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/bio/bio_lib.c:71:6: Taking true branch
    69.   
    70.   	ret=(BIO *)OPENSSL_malloc(sizeof(BIO));
    71.   	if (ret == NULL)
               ^
    72.   		{
    73.   		BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);

crypto/bio/bio_lib.c:73:3: 
    71.   	if (ret == NULL)
    72.   		{
    73. > 		BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);
    74.   		return(NULL);
    75.   		}

crypto/err/err.c:615:1: start of procedure ERR_put_error()
      613.   /********************************************************/
      614.   
      615. > void ERR_put_error(int lib, int func, int reason, const char *file,
      616.   	     int line)
      617.   	{

crypto/err/err.c:639:2: Skipping ERR_get_state(): empty list of specs
      637.   	}
      638.   #endif
      639.   	es=ERR_get_state();
              ^
      640.   
      641.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:641:2: 
      639.   	es=ERR_get_state();
      640.   
      641. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
      642.   	if (es->top == es->bottom)
      643.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:642:6: Taking false branch
      640.   
      641.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
      642.   	if (es->top == es->bottom)
                  ^
      643.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      644.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:644:2: 
      642.   	if (es->top == es->bottom)
      643.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      644. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      645.   	es->err_file[es->top]=file;
      646.   	es->err_line[es->top]=line;

crypto/err/err.c:645:2: 
      643.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      644.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      645. > 	es->err_file[es->top]=file;
      646.   	es->err_line[es->top]=line;
      647.   	err_clear_data(es,es->top);

crypto/err/err.c:646:2: 
      644.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      645.   	es->err_file[es->top]=file;
      646. > 	es->err_line[es->top]=line;
      647.   	err_clear_data(es,es->top);
      648.   	}

crypto/err/err.c:647:2: Taking true branch
      645.   	es->err_file[es->top]=file;
      646.   	es->err_line[es->top]=line;
      647.   	err_clear_data(es,es->top);
              ^
      648.   	}
      649.   

crypto/err/err.c:647:2: Taking false branch
      645.   	es->err_file[es->top]=file;
      646.   	es->err_line[es->top]=line;
      647.   	err_clear_data(es,es->top);
              ^
      648.   	}
      649.   

crypto/err/err.c:648:2: return from a call to ERR_put_error
      646.   	es->err_line[es->top]=line;
      647.   	err_clear_data(es,es->top);
      648.   	}
              ^
      649.   
      650.   void ERR_clear_error(void)

crypto/bio/bio_lib.c:74:3: 
    72.   		{
    73.   		BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);
    74. > 		return(NULL);
    75.   		}
    76.   	if (!BIO_set(ret,method))

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

ssl/ssl_cert.c:681:6: Taking true branch
  679.   	in=BIO_new(BIO_s_file_internal());
  680.   	
  681.   	if (in == NULL)
              ^
  682.   		{
  683.   		SSLerr(SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK,ERR_R_MALLOC_FAILURE);

ssl/ssl_cert.c:683:3: 
  681.   	if (in == NULL)
  682.   		{
  683. > 		SSLerr(SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK,ERR_R_MALLOC_FAILURE);
  684.   		goto err;
  685.   		}

crypto/err/err.c:615:1: start of procedure ERR_put_error()
    613.   /********************************************************/
    614.   
    615. > void ERR_put_error(int lib, int func, int reason, const char *file,
    616.   	     int line)
    617.   	{

crypto/err/err.c:639:2: Skipping ERR_get_state(): empty list of specs
    637.   	}
    638.   #endif
    639.   	es=ERR_get_state();
            ^
    640.   
    641.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:641:2: 
    639.   	es=ERR_get_state();
    640.   
    641. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    642.   	if (es->top == es->bottom)
    643.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:642:6: Taking false branch
    640.   
    641.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    642.   	if (es->top == es->bottom)
                ^
    643.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    644.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:644:2: 
    642.   	if (es->top == es->bottom)
    643.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    644. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    645.   	es->err_file[es->top]=file;
    646.   	es->err_line[es->top]=line;

crypto/err/err.c:645:2: 
    643.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    644.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    645. > 	es->err_file[es->top]=file;
    646.   	es->err_line[es->top]=line;
    647.   	err_clear_data(es,es->top);

crypto/err/err.c:646:2: 
    644.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    645.   	es->err_file[es->top]=file;
    646. > 	es->err_line[es->top]=line;
    647.   	err_clear_data(es,es->top);
    648.   	}

crypto/err/err.c:647:2: Taking true branch
    645.   	es->err_file[es->top]=file;
    646.   	es->err_line[es->top]=line;
    647.   	err_clear_data(es,es->top);
            ^
    648.   	}
    649.   

crypto/err/err.c:647:2: Taking false branch
    645.   	es->err_file[es->top]=file;
    646.   	es->err_line[es->top]=line;
    647.   	err_clear_data(es,es->top);
            ^
    648.   	}
    649.   

crypto/err/err.c:648:2: return from a call to ERR_put_error
    646.   	es->err_line[es->top]=line;
    647.   	err_clear_data(es,es->top);
    648.   	}
            ^
    649.   
    650.   void ERR_clear_error(void)

ssl/ssl_cert.c:705:1: 
  703.   	if (0)
  704.   		{
  705. > err:
  706.   		ret=0;
  707.   		}

ssl/ssl_cert.c:706:3: 
  704.   		{
  705.   err:
  706. > 		ret=0;
  707.   		}
  708.   	if(in != NULL)

ssl/ssl_cert.c:708:5: Taking false branch
  706.   		ret=0;
  707.   		}
  708.   	if(in != NULL)
             ^
  709.   		BIO_free(in);
  710.   	if(x != NULL)

ssl/ssl_cert.c:710:5: Taking false branch
  708.   	if(in != NULL)
  709.   		BIO_free(in);
  710.   	if(x != NULL)
             ^
  711.   		X509_free(x);
  712.   	

ssl/ssl_cert.c:713:2: 
  711.   		X509_free(x);
  712.   	
  713. > 	sk_X509_NAME_set_cmp_func(stack,oldcmp);
  714.   
  715.   	return ret;

crypto/stack/stack.c:79:1: start of procedure sk_set_cmp_func()
    77.   #include <errno.h>
    78.   
    79. > int (*sk_set_cmp_func(STACK *sk, int (*c)(const char * const *,const char * const *)))
    80.   		(const char * const *, const char * const *)
    81.   	{

crypto/stack/stack.c:82:2: 
    80.   		(const char * const *, const char * const *)
    81.   	{
    82. > 	int (*old)(const char * const *,const char * const *)=sk->comp;
    83.   
    84.   	if (sk->comp != c)

crypto/stack/stack.c:84:6: Taking true branch
    82.   	int (*old)(const char * const *,const char * const *)=sk->comp;
    83.   
    84.   	if (sk->comp != c)
               ^
    85.   		sk->sorted=0;
    86.   	sk->comp=c;

crypto/stack/stack.c:85:3: 
    83.   
    84.   	if (sk->comp != c)
    85. > 		sk->sorted=0;
    86.   	sk->comp=c;
    87.   

crypto/stack/stack.c:86:2: 
    84.   	if (sk->comp != c)
    85.   		sk->sorted=0;
    86. > 	sk->comp=c;
    87.   
    88.   	return old;

crypto/stack/stack.c:88:2: 
    86.   	sk->comp=c;
    87.   
    88. > 	return old;
    89.   	}
    90.   

crypto/stack/stack.c:89:2: return from a call to sk_set_cmp_func
    87.   
    88.   	return old;
    89.   	}
           ^
    90.   
    91.   STACK *sk_dup(STACK *sk)

ssl/ssl_cert.c:715:2: 
  713.   	sk_X509_NAME_set_cmp_func(stack,oldcmp);
  714.   
  715. > 	return ret;
  716.   	}
  717.   

ssl/ssl_cert.c:716:2: return from a call to SSL_add_file_cert_subjects_to_stack
  714.   
  715.   	return ret;
  716.   	}
          ^
  717.   
  718.   /*!

ssl/ssl_cert.c:766:7: Taking true branch
764.   		if (r <= 0 || r >= sizeof buf)
765.   			goto err;
766.   		if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
             ^
767.   			goto err;
768.   		}

int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
				       const char *dir)
	{
	DIR *d;
	struct dirent *dstruct;
	int ret = 0;
	CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
	d = opendir(dir);
	if(!d)
		{
		SYSerr(SYS_F_OPENDIR, get_last_sys_error());
		ERR_add_error_data(3, "opendir('", dir, "')");
		SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB);
		goto err;
		}
	while((dstruct=readdir(d)))
		{
		char buf[1024];
		int r;
		if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf)
			{
			SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG);
			goto err;
			}
		r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name);
		if (r <= 0 || r >= sizeof buf)
			goto err;
		if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
			goto err;
		}
	ret = 1;
err:
	CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
	return ret;
	}
['int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,\n\t\t\t\t       const char *dir)\n\t{\n\tDIR *d;\n\tstruct dirent *dstruct;\n\tint ret = 0;\n\tCRYPTO_w_lock(CRYPTO_LOCK_READDIR);\n\td = opendir(dir);\n\tif(!d)\n\t\t{\n\t\tSYSerr(SYS_F_OPENDIR, get_last_sys_error());\n\t\tERR_add_error_data(3, "opendir(\'", dir, "\')");\n\t\tSSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB);\n\t\tgoto err;\n\t\t}\n\twhile((dstruct=readdir(d)))\n\t\t{\n\t\tchar buf[1024];\n\t\tint r;\n\t\tif(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf)\n\t\t\t{\n\t\t\tSSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG);\n\t\t\tgoto err;\n\t\t\t}\n\t\tr = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name);\n\t\tif (r <= 0 || r >= sizeof buf)\n\t\t\tgoto err;\n\t\tif(!SSL_add_file_cert_subjects_to_stack(stack,buf))\n\t\t\tgoto err;\n\t\t}\n\tret = 1;\nerr:\n\tCRYPTO_w_unlock(CRYPTO_LOCK_READDIR);\n\treturn ret;\n\t}', 'void CRYPTO_lock(int mode, int type, const char *file, int line)\n\t{\n#ifdef LOCK_DEBUG\n\t\t{\n\t\tchar *rw_text,*operation_text;\n\t\tif (mode & CRYPTO_LOCK)\n\t\t\toperation_text="lock  ";\n\t\telse if (mode & CRYPTO_UNLOCK)\n\t\t\toperation_text="unlock";\n\t\telse\n\t\t\toperation_text="ERROR ";\n\t\tif (mode & CRYPTO_READ)\n\t\t\trw_text="r";\n\t\telse if (mode & CRYPTO_WRITE)\n\t\t\trw_text="w";\n\t\telse\n\t\t\trw_text="ERROR";\n\t\tfprintf(stderr,"lock:%08lx:(%s)%s %-18s %s:%d\\n",\n\t\t\tCRYPTO_thread_id(), rw_text, operation_text,\n\t\t\tCRYPTO_get_lock_name(type), file, line);\n\t\t}\n#endif\n\tif (type < 0)\n\t\t{\n\t\tstruct CRYPTO_dynlock_value *pointer\n\t\t\t= CRYPTO_get_dynlock_value(type);\n\t\tif (pointer && dynlock_lock_callback)\n\t\t\t{\n\t\t\tdynlock_lock_callback(mode, pointer, file, line);\n\t\t\t}\n\t\tCRYPTO_destroy_dynlockid(type);\n\t\t}\n\telse\n\t\tif (locking_callback != NULL)\n\t\t\tlocking_callback(mode,type,file,line);\n\t}', 'int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,\n\t\t\t\t\tconst char *file)\n\t{\n\tBIO *in;\n\tX509 *x=NULL;\n\tX509_NAME *xn=NULL;\n\tint ret=1;\n\tint (*oldcmp)(const X509_NAME * const *a, const X509_NAME * const *b);\n\toldcmp=sk_X509_NAME_set_cmp_func(stack,xname_cmp);\n\tin=BIO_new(BIO_s_file_internal());\n\tif (in == NULL)\n\t\t{\n\t\tSSLerr(SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK,ERR_R_MALLOC_FAILURE);\n\t\tgoto err;\n\t\t}\n\tif (!BIO_read_filename(in,file))\n\t\tgoto err;\n\tfor (;;)\n\t\t{\n\t\tif (PEM_read_bio_X509(in,&x,NULL,NULL) == NULL)\n\t\t\tbreak;\n\t\tif ((xn=X509_get_subject_name(x)) == NULL) goto err;\n\t\txn=X509_NAME_dup(xn);\n\t\tif (xn == NULL) goto err;\n\t\tif (sk_X509_NAME_find(stack,xn) >= 0)\n\t\t\tX509_NAME_free(xn);\n\t\telse\n\t\t\tsk_X509_NAME_push(stack,xn);\n\t\t}\n\tif (0)\n\t\t{\nerr:\n\t\tret=0;\n\t\t}\n\tif(in != NULL)\n\t\tBIO_free(in);\n\tif(x != NULL)\n\t\tX509_free(x);\n\tsk_X509_NAME_set_cmp_func(stack,oldcmp);\n\treturn ret;\n\t}', 'int (*sk_set_cmp_func(STACK *sk, int (*c)(const char * const *,const char * const *)))\n\t\t(const char * const *, const char * const *)\n\t{\n\tint (*old)(const char * const *,const char * const *)=sk->comp;\n\tif (sk->comp != c)\n\t\tsk->sorted=0;\n\tsk->comp=c;\n\treturn old;\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_ex_func(num,file,line);\n#ifdef LEVITTE_DEBUG_MEM\n\tfprintf(stderr, "LEVITTE_DEBUG_MEM:         > 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}', '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}']