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


ssl/ssl_cert.c:737:1: start of procedure SSL_add_dir_cert_subjects_to_stack()
735.   #ifndef OPENSSL_SYS_MACINTOSH_CLASSIC /* XXXXX: Better scheme needed! */
736.   
737. > int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
738.   				       const char *dir)
739.   	{

ssl/ssl_cert.c:742:2: 
740.   	DIR *d;
741.   	struct dirent *dstruct;
742. > 	int ret = 0;
743.   
744.   	CRYPTO_w_lock(CRYPTO_LOCK_READDIR);

ssl/ssl_cert.c:744:2: 
742.   	int ret = 0;
743.   
744. > 	CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
745.   	d = opendir(dir);
746.   

crypto/cryptlib.c:379:1: start of procedure CRYPTO_lock()
  377.   	}
  378.   
  379. > void CRYPTO_lock(int mode, int type, const char *file, int line)
  380.   	{
  381.   #ifdef LOCK_DEBUG

crypto/cryptlib.c:404:6: Taking false branch
  402.   		}
  403.   #endif
  404.   	if (type < 0)
              ^
  405.   		{
  406.   		struct CRYPTO_dynlock_value *pointer

crypto/cryptlib.c:417:7: Taking true branch
  415.   		}
  416.   	else
  417.   		if (locking_callback != NULL)
               ^
  418.   			locking_callback(mode,type,file,line);
  419.   	}

crypto/cryptlib.c:418:4: Skipping __function_pointer__(): unresolved function pointer
  416.   	else
  417.   		if (locking_callback != NULL)
  418.   			locking_callback(mode,type,file,line);
            ^
  419.   	}
  420.   

crypto/cryptlib.c:404:2: 
  402.   		}
  403.   #endif
  404. > 	if (type < 0)
  405.   		{
  406.   		struct CRYPTO_dynlock_value *pointer

crypto/cryptlib.c:419:2: return from a call to CRYPTO_lock
  417.   		if (locking_callback != NULL)
  418.   			locking_callback(mode,type,file,line);
  419.   	}
          ^
  420.   
  421.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

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

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

ssl/ssl_cert.c:756:9: Loop condition is true. Entering loop body
754.   		}
755.   	
756.   	while((dstruct=readdir(d)))
               ^
757.   		{
758.   		char buf[1024];

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

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

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

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

ssl/ssl_cert.c:770:7: 
768.   		if (r <= 0 || r >= sizeof buf)
769.   			goto err;
770. > 		if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
771.   			goto err;
772.   		}

ssl/ssl_cert.c:672:1: start of procedure SSL_add_file_cert_subjects_to_stack()
  670.    */
  671.   
  672. > int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
  673.   					const char *file)
  674.   	{

ssl/ssl_cert.c:676:2: 
  674.   	{
  675.   	BIO *in;
  676. > 	X509 *x=NULL;
  677.   	X509_NAME *xn=NULL;
  678.   	int ret=1;

ssl/ssl_cert.c:677:2: 
  675.   	BIO *in;
  676.   	X509 *x=NULL;
  677. > 	X509_NAME *xn=NULL;
  678.   	int ret=1;
  679.   	int (*oldcmp)(const X509_NAME * const *a, const X509_NAME * const *b);

ssl/ssl_cert.c:678:2: 
  676.   	X509 *x=NULL;
  677.   	X509_NAME *xn=NULL;
  678. > 	int ret=1;
  679.   	int (*oldcmp)(const X509_NAME * const *a, const X509_NAME * const *b);
  680.   	

ssl/ssl_cert.c:681:2: 
  679.   	int (*oldcmp)(const X509_NAME * const *a, const X509_NAME * const *b);
  680.   	
  681. > 	oldcmp=sk_X509_NAME_set_cmp_func(stack,xname_cmp);
  682.   	
  683.   	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:683:2: 
  681.   	oldcmp=sk_X509_NAME_set_cmp_func(stack,xname_cmp);
  682.   	
  683. > 	in=BIO_new(BIO_s_file_internal());
  684.   	
  685.   	if (in == NULL)

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

crypto/bio/bss_file.c:132:2: 
    130.   BIO_METHOD *BIO_s_file(void)
    131.   	{
    132. > 	return(&methods_filep);
    133.   	}
    134.   

crypto/bio/bss_file.c:133:2: return from a call to BIO_s_file
    131.   	{
    132.   	return(&methods_filep);
    133.   	}
            ^
    134.   
    135.   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:685:6: Taking true branch
  683.   	in=BIO_new(BIO_s_file_internal());
  684.   	
  685.   	if (in == NULL)
              ^
  686.   		{
  687.   		SSLerr(SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK,ERR_R_MALLOC_FAILURE);

ssl/ssl_cert.c:687:3: 
  685.   	if (in == NULL)
  686.   		{
  687. > 		SSLerr(SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK,ERR_R_MALLOC_FAILURE);
  688.   		goto err;
  689.   		}

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:709:1: 
  707.   	if (0)
  708.   		{
  709. > err:
  710.   		ret=0;
  711.   		}

ssl/ssl_cert.c:710:3: 
  708.   		{
  709.   err:
  710. > 		ret=0;
  711.   		}
  712.   	if(in != NULL)

ssl/ssl_cert.c:712:5: Taking false branch
  710.   		ret=0;
  711.   		}
  712.   	if(in != NULL)
             ^
  713.   		BIO_free(in);
  714.   	if(x != NULL)

ssl/ssl_cert.c:714:5: Taking false branch
  712.   	if(in != NULL)
  713.   		BIO_free(in);
  714.   	if(x != NULL)
             ^
  715.   		X509_free(x);
  716.   	

ssl/ssl_cert.c:717:2: 
  715.   		X509_free(x);
  716.   	
  717. > 	sk_X509_NAME_set_cmp_func(stack,oldcmp);
  718.   
  719.   	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:719:2: 
  717.   	sk_X509_NAME_set_cmp_func(stack,oldcmp);
  718.   
  719. > 	return ret;
  720.   	}
  721.   

ssl/ssl_cert.c:720:2: return from a call to SSL_add_file_cert_subjects_to_stack
  718.   
  719.   	return ret;
  720.   	}
          ^
  721.   
  722.   /*!

ssl/ssl_cert.c:770:7: Taking true branch
768.   		if (r <= 0 || r >= sizeof buf)
769.   			goto err;
770.   		if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
             ^
771.   			goto err;
772.   		}
