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


ssl/ssl_cert.c:693:1: start of procedure SSL_add_dir_cert_subjects_to_stack()
691.   #ifndef MAC_OS_pre_X
692.   
693. > int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
694.   				       const char *dir)
695.       {

ssl/ssl_cert.c:698:5: 
696.       DIR *d;
697.       struct dirent *dstruct;
698. >     int ret = 0;
699.   
700.       CRYPTO_w_lock(CRYPTO_LOCK_READDIR);

ssl/ssl_cert.c:700:5: 
698.       int ret = 0;
699.   
700. >     CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
701.       d = opendir(dir);
702.   

crypto/cryptlib.c:197:1: start of procedure CRYPTO_lock()
  195.   	}
  196.   
  197. > void CRYPTO_lock(int mode, int type, const char *file, int line)
  198.   	{
  199.   #ifdef LOCK_DEBUG

crypto/cryptlib.c:222:6: Taking true branch
  220.   		}
  221.   #endif
  222.   	if (locking_callback != NULL)
              ^
  223.   		locking_callback(mode,type,file,line);
  224.   	}

crypto/cryptlib.c:223:3: Skipping __function_pointer__(): unresolved function pointer
  221.   #endif
  222.   	if (locking_callback != NULL)
  223.   		locking_callback(mode,type,file,line);
           ^
  224.   	}
  225.   

crypto/cryptlib.c:222:2: 
  220.   		}
  221.   #endif
  222. > 	if (locking_callback != NULL)
  223.   		locking_callback(mode,type,file,line);
  224.   	}

crypto/cryptlib.c:224:2: return from a call to CRYPTO_lock
  222.   	if (locking_callback != NULL)
  223.   		locking_callback(mode,type,file,line);
  224.   	}
          ^
  225.   
  226.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

ssl/ssl_cert.c:701:5: 
699.   
700.       CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
701. >     d = opendir(dir);
702.   
703.       /* Note that a side effect is that the CAs will be sorted by name */

ssl/ssl_cert.c:704:9: Taking false branch
702.   
703.       /* Note that a side effect is that the CAs will be sorted by name */
704.       if(!d)
               ^
705.   	{
706.   	SYSerr(SYS_F_OPENDIR, get_last_sys_error());

ssl/ssl_cert.c:712:12: Loop condition is true. Entering loop body
710.   	}
711.   
712.       while((dstruct=readdir(d)))
                  ^
713.   	{
714.   	char buf[1024];

ssl/ssl_cert.c:716:5: Taking false branch
714.   	char buf[1024];
715.   
716.   	if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf)
           ^
717.   	    {
718.   	    SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG);

ssl/ssl_cert.c:722:2: 
720.   	    }
721.   	
722. > 	sprintf(buf,"%s/%s",dir,dstruct->d_name);
723.   	if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
724.   	    goto err;

ssl/ssl_cert.c:723:6: 
721.   	
722.   	sprintf(buf,"%s/%s",dir,dstruct->d_name);
723. > 	if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
724.   	    goto err;
725.   	}

ssl/ssl_cert.c:628:1: start of procedure SSL_add_file_cert_subjects_to_stack()
  626.    */
  627.   
  628. > int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
  629.   					const char *file)
  630.       {

ssl/ssl_cert.c:632:5: 
  630.       {
  631.       BIO *in;
  632. >     X509 *x=NULL;
  633.       X509_NAME *xn=NULL;
  634.       int ret=1;

ssl/ssl_cert.c:633:5: 
  631.       BIO *in;
  632.       X509 *x=NULL;
  633. >     X509_NAME *xn=NULL;
  634.       int ret=1;
  635.       int (*oldcmp)(X509_NAME **a, X509_NAME **b);

ssl/ssl_cert.c:634:5: 
  632.       X509 *x=NULL;
  633.       X509_NAME *xn=NULL;
  634. >     int ret=1;
  635.       int (*oldcmp)(X509_NAME **a, X509_NAME **b);
  636.   

ssl/ssl_cert.c:637:5: 
  635.       int (*oldcmp)(X509_NAME **a, X509_NAME **b);
  636.   
  637. >     oldcmp=sk_X509_NAME_set_cmp_func(stack,xname_cmp);
  638.   
  639.       in=BIO_new(BIO_s_file_internal());

crypto/x509/x509_vfy.c:802:1: start of procedure sk_X509_NAME_set_cmp_func()
    800.   IMPLEMENT_ASN1_SET_OF(X509)
    801.   
    802. > IMPLEMENT_STACK_OF(X509_NAME)
    803.   
    804.   IMPLEMENT_STACK_OF(X509_ATTRIBUTE)

crypto/stack/stack.c:80:1: start of procedure sk_set_cmp_func()
      78.   #include <errno.h>
      79.   
      80. > int (*sk_set_cmp_func(STACK *sk, int (*c)()))(void)
      81.   	{
      82.   	int (*old)()=sk->comp;

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

crypto/stack/stack.c:84:6: Taking true branch
      82.   	int (*old)()=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)

crypto/x509/x509_vfy.c:802:1: return from a call to sk_X509_NAME_set_cmp_func
    800.   IMPLEMENT_ASN1_SET_OF(X509)
    801.   
    802. > IMPLEMENT_STACK_OF(X509_NAME)
    803.   
    804.   IMPLEMENT_STACK_OF(X509_ATTRIBUTE)

ssl/ssl_cert.c:639:5: 
  637.       oldcmp=sk_X509_NAME_set_cmp_func(stack,xname_cmp);
  638.   
  639. >     in=BIO_new(BIO_s_file_internal());
  640.   
  641.       if (in == NULL)

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

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

crypto/bio/bss_file.c:129:2: return from a call to BIO_s_file
    127.   	{
    128.   	return(&methods_filep);
    129.   	}
            ^
    130.   
    131.   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 *)Malloc(sizeof(BIO));

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

crypto/mem.c:194:1: start of procedure CRYPTO_malloc()
      192.   	}
      193.   
      194. > void *CRYPTO_malloc(int num, char *file, int line)
      195.   	{
      196.   	char *ret = NULL;

crypto/mem.c:196:2: 
      194.   void *CRYPTO_malloc(int num, char *file, int line)
      195.   	{
      196. > 	char *ret = NULL;
      197.   
      198.   	allow_customize = 0;

crypto/mem.c:198:2: 
      196.   	char *ret = NULL;
      197.   
      198. > 	allow_customize = 0;
      199.   	if (malloc_debug_func != NULL)
      200.   		{

crypto/mem.c:199:6: Taking false branch
      197.   
      198.   	allow_customize = 0;
      199.   	if (malloc_debug_func != NULL)
                  ^
      200.   		{
      201.   		allow_customize_debug = 0;

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

crypto/mem.c:208:6: Taking false branch
      206.   	fprintf(stderr, "LEVITTE_DEBUG:         > 0x%p (%d)\n", ret, num);
      207.   #endif
      208.   	if (malloc_debug_func != NULL)
                  ^
      209.   		malloc_debug_func(ret, num, file, line, 1);
      210.   

crypto/mem.c:211:2: 
      209.   		malloc_debug_func(ret, num, file, line, 1);
      210.   
      211. > 	return ret;
      212.   	}
      213.   

crypto/mem.c:212:2: return from a call to CRYPTO_malloc
      210.   
      211.   	return ret;
      212.   	}
              ^
      213.   
      214.   void *CRYPTO_realloc(void *str, int num, char *file, int line)

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

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

crypto/err/err.c:246:1: start of procedure ERR_put_error()
      244.   /********************************************************/
      245.   
      246. > void ERR_put_error(int lib, int func, int reason, const char *file,
      247.   	     int line)
      248.   	{

crypto/err/err.c:270:2: Skipping ERR_get_state(): empty list of specs
      268.   	}
      269.   #endif
      270.   	es=ERR_get_state();
              ^
      271.   
      272.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:272:2: 
      270.   	es=ERR_get_state();
      271.   
      272. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
      273.   	if (es->top == es->bottom)
      274.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:273:6: Taking false branch
      271.   
      272.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
      273.   	if (es->top == es->bottom)
                  ^
      274.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      275.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:275:2: 
      273.   	if (es->top == es->bottom)
      274.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      275. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      276.   	es->err_file[es->top]=file;
      277.   	es->err_line[es->top]=line;

crypto/err/err.c:276:2: 
      274.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      275.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      276. > 	es->err_file[es->top]=file;
      277.   	es->err_line[es->top]=line;
      278.   	err_clear_data(es,es->top);

crypto/err/err.c:277:2: 
      275.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      276.   	es->err_file[es->top]=file;
      277. > 	es->err_line[es->top]=line;
      278.   	err_clear_data(es,es->top);
      279.   	}

crypto/err/err.c:278:2: Taking true branch
      276.   	es->err_file[es->top]=file;
      277.   	es->err_line[es->top]=line;
      278.   	err_clear_data(es,es->top);
              ^
      279.   	}
      280.   

crypto/err/err.c:278:2: Taking false branch
      276.   	es->err_file[es->top]=file;
      277.   	es->err_line[es->top]=line;
      278.   	err_clear_data(es,es->top);
              ^
      279.   	}
      280.   

crypto/err/err.c:279:2: return from a call to ERR_put_error
      277.   	es->err_line[es->top]=line;
      278.   	err_clear_data(es,es->top);
      279.   	}
              ^
      280.   
      281.   void ERR_clear_error(void)

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

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)

ssl/ssl_cert.c:641:9: Taking true branch
  639.       in=BIO_new(BIO_s_file_internal());
  640.   
  641.       if (in == NULL)
                 ^
  642.   	{
  643.   	SSLerr(SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK,ERR_R_MALLOC_FAILURE);

ssl/ssl_cert.c:643:2: 
  641.       if (in == NULL)
  642.   	{
  643. > 	SSLerr(SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK,ERR_R_MALLOC_FAILURE);
  644.   	goto err;
  645.   	}

crypto/err/err.c:246:1: start of procedure ERR_put_error()
    244.   /********************************************************/
    245.   
    246. > void ERR_put_error(int lib, int func, int reason, const char *file,
    247.   	     int line)
    248.   	{

crypto/err/err.c:270:2: Skipping ERR_get_state(): empty list of specs
    268.   	}
    269.   #endif
    270.   	es=ERR_get_state();
            ^
    271.   
    272.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:272:2: 
    270.   	es=ERR_get_state();
    271.   
    272. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    273.   	if (es->top == es->bottom)
    274.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:273:6: Taking false branch
    271.   
    272.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    273.   	if (es->top == es->bottom)
                ^
    274.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    275.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:275:2: 
    273.   	if (es->top == es->bottom)
    274.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    275. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    276.   	es->err_file[es->top]=file;
    277.   	es->err_line[es->top]=line;

crypto/err/err.c:276:2: 
    274.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    275.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    276. > 	es->err_file[es->top]=file;
    277.   	es->err_line[es->top]=line;
    278.   	err_clear_data(es,es->top);

crypto/err/err.c:277:2: 
    275.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    276.   	es->err_file[es->top]=file;
    277. > 	es->err_line[es->top]=line;
    278.   	err_clear_data(es,es->top);
    279.   	}

crypto/err/err.c:278:2: Taking true branch
    276.   	es->err_file[es->top]=file;
    277.   	es->err_line[es->top]=line;
    278.   	err_clear_data(es,es->top);
            ^
    279.   	}
    280.   

crypto/err/err.c:278:2: Taking false branch
    276.   	es->err_file[es->top]=file;
    277.   	es->err_line[es->top]=line;
    278.   	err_clear_data(es,es->top);
            ^
    279.   	}
    280.   

crypto/err/err.c:279:2: return from a call to ERR_put_error
    277.   	es->err_line[es->top]=line;
    278.   	err_clear_data(es,es->top);
    279.   	}
            ^
    280.   
    281.   void ERR_clear_error(void)

ssl/ssl_cert.c:665:1: 
  663.       if (0)
  664.   	{
  665. > err:
  666.   	ret=0;
  667.   	}

ssl/ssl_cert.c:666:2: 
  664.   	{
  665.   err:
  666. > 	ret=0;
  667.   	}
  668.       if(in != NULL)

ssl/ssl_cert.c:668:8: Taking false branch
  666.   	ret=0;
  667.   	}
  668.       if(in != NULL)
                ^
  669.   	BIO_free(in);
  670.       if(x != NULL)

ssl/ssl_cert.c:670:8: Taking false branch
  668.       if(in != NULL)
  669.   	BIO_free(in);
  670.       if(x != NULL)
                ^
  671.   	X509_free(x);
  672.   

ssl/ssl_cert.c:673:5: 
  671.   	X509_free(x);
  672.   
  673. >     sk_X509_NAME_set_cmp_func(stack,oldcmp);
  674.   
  675.       return ret;

crypto/x509/x509_vfy.c:802:1: start of procedure sk_X509_NAME_set_cmp_func()
    800.   IMPLEMENT_ASN1_SET_OF(X509)
    801.   
    802. > IMPLEMENT_STACK_OF(X509_NAME)
    803.   
    804.   IMPLEMENT_STACK_OF(X509_ATTRIBUTE)

crypto/stack/stack.c:80:1: start of procedure sk_set_cmp_func()
      78.   #include <errno.h>
      79.   
      80. > int (*sk_set_cmp_func(STACK *sk, int (*c)()))(void)
      81.   	{
      82.   	int (*old)()=sk->comp;

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

crypto/stack/stack.c:84:6: Taking true branch
      82.   	int (*old)()=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)

crypto/x509/x509_vfy.c:802:1: return from a call to sk_X509_NAME_set_cmp_func
    800.   IMPLEMENT_ASN1_SET_OF(X509)
    801.   
    802. > IMPLEMENT_STACK_OF(X509_NAME)
    803.   
    804.   IMPLEMENT_STACK_OF(X509_ATTRIBUTE)

ssl/ssl_cert.c:675:5: 
  673.       sk_X509_NAME_set_cmp_func(stack,oldcmp);
  674.   
  675. >     return ret;
  676.       }
  677.   

ssl/ssl_cert.c:676:5: return from a call to SSL_add_file_cert_subjects_to_stack
  674.   
  675.       return ret;
  676.       }
             ^
  677.   
  678.   /*!

ssl/ssl_cert.c:723:6: Taking true branch
721.   	
722.   	sprintf(buf,"%s/%s",dir,dstruct->d_name);
723.   	if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
            ^
724.   	    goto err;
725.   	}

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];
	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;
	    }
	sprintf(buf,"%s/%s",dir,dstruct->d_name);
	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    {\n    DIR *d;\n    struct dirent *dstruct;\n    int ret = 0;\n    CRYPTO_w_lock(CRYPTO_LOCK_READDIR);\n    d = opendir(dir);\n    if(!d)\n\t{\n\tSYSerr(SYS_F_OPENDIR, get_last_sys_error());\n\tERR_add_error_data(3, "opendir(\'", dir, "\')");\n\tSSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB);\n\tgoto err;\n\t}\n    while((dstruct=readdir(d)))\n\t{\n\tchar buf[1024];\n\tif(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf)\n\t    {\n\t    SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG);\n\t    goto err;\n\t    }\n\tsprintf(buf,"%s/%s",dir,dstruct->d_name);\n\tif(!SSL_add_file_cert_subjects_to_stack(stack,buf))\n\t    goto err;\n\t}\n    ret = 1;\nerr:\n    CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);\n    return ret;\n    }', '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 (locking_callback != NULL)\n\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    {\n    BIO *in;\n    X509 *x=NULL;\n    X509_NAME *xn=NULL;\n    int ret=1;\n    int (*oldcmp)(X509_NAME **a, X509_NAME **b);\n    oldcmp=sk_X509_NAME_set_cmp_func(stack,xname_cmp);\n    in=BIO_new(BIO_s_file_internal());\n    if (in == NULL)\n\t{\n\tSSLerr(SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK,ERR_R_MALLOC_FAILURE);\n\tgoto err;\n\t}\n    if (!BIO_read_filename(in,file))\n\tgoto err;\n    for (;;)\n\t{\n\tif (PEM_read_bio_X509(in,&x,NULL,NULL) == NULL)\n\t    break;\n\tif ((xn=X509_get_subject_name(x)) == NULL) goto err;\n\txn=X509_NAME_dup(xn);\n\tif (xn == NULL) goto err;\n\tif (sk_X509_NAME_find(stack,xn) >= 0)\n\t    X509_NAME_free(xn);\n\telse\n\t    sk_X509_NAME_push(stack,xn);\n\t}\n    if (0)\n\t{\nerr:\n\tret=0;\n\t}\n    if(in != NULL)\n\tBIO_free(in);\n    if(x != NULL)\n\tX509_free(x);\n    sk_X509_NAME_set_cmp_func(stack,oldcmp);\n    return ret;\n    }', 'IMPLEMENT_STACK_OF(X509_NAME)', 'int (*sk_set_cmp_func(STACK *sk, int (*c)()))(void)\n\t{\n\tint (*old)()=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 *)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\tFree(ret);\n\t\tret=NULL;\n\t\t}\n\treturn(ret);\n\t}', 'void *CRYPTO_malloc(int num, char *file, int line)\n\t{\n\tchar *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}', '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}']