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


ssl/ssl_cert.c:710:1: start of procedure SSL_add_dir_cert_subjects_to_stack()
708.   #ifndef MAC_OS_pre_X
709.   
710. > int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
711.   				       const char *dir)
712.       {

ssl/ssl_cert.c:715:5: 
713.       DIR *d;
714.       struct dirent *dstruct;
715. >     int ret = 0;
716.   
717.       CRYPTO_w_lock(CRYPTO_LOCK_READDIR);

ssl/ssl_cert.c:717:5: 
715.       int ret = 0;
716.   
717. >     CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
718.       d = opendir(dir);
719.   

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:718:5: 
716.   
717.       CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
718. >     d = opendir(dir);
719.   
720.       /* Note that a side effect is that the CAs will be sorted by name */

ssl/ssl_cert.c:721:9: Taking false branch
719.   
720.       /* Note that a side effect is that the CAs will be sorted by name */
721.       if(!d)
               ^
722.   	{
723.   	SYSerr(SYS_F_OPENDIR, get_last_sys_error());

ssl/ssl_cert.c:729:12: Loop condition is true. Entering loop body
727.   	}
728.   
729.       while((dstruct=readdir(d)))
                  ^
730.   	{
731.   	char buf[1024];

ssl/ssl_cert.c:733:5: Taking false branch
731.   	char buf[1024];
732.   
733.   	if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf)
           ^
734.   	    {
735.   	    SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG);

ssl/ssl_cert.c:739:2: 
737.   	    }
738.   	
739. > 	sprintf(buf,"%s/%s",dir,dstruct->d_name);
740.   	if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
741.   	    goto err;

ssl/ssl_cert.c:740:6: 
738.   	
739.   	sprintf(buf,"%s/%s",dir,dstruct->d_name);
740. > 	if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
741.   	    goto err;
742.   	}

ssl/ssl_cert.c:645:1: start of procedure SSL_add_file_cert_subjects_to_stack()
  643.    */
  644.   
  645. > int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
  646.   					const char *file)
  647.       {

ssl/ssl_cert.c:649:5: 
  647.       {
  648.       BIO *in;
  649. >     X509 *x=NULL;
  650.       X509_NAME *xn=NULL;
  651.       int ret=1;

ssl/ssl_cert.c:650:5: 
  648.       BIO *in;
  649.       X509 *x=NULL;
  650. >     X509_NAME *xn=NULL;
  651.       int ret=1;
  652.       int (*oldcmp)(X509_NAME **a, X509_NAME **b);

ssl/ssl_cert.c:651:5: 
  649.       X509 *x=NULL;
  650.       X509_NAME *xn=NULL;
  651. >     int ret=1;
  652.       int (*oldcmp)(X509_NAME **a, X509_NAME **b);
  653.   

ssl/ssl_cert.c:654:5: 
  652.       int (*oldcmp)(X509_NAME **a, X509_NAME **b);
  653.   
  654. >     oldcmp=sk_X509_NAME_set_cmp_func(stack,xname_cmp);
  655.   
  656.       in=BIO_new(BIO_s_file_internal());

crypto/x509/x509_vfy.c:812:1: start of procedure sk_X509_NAME_set_cmp_func()
    810.   IMPLEMENT_ASN1_SET_OF(X509)
    811.   
    812. > IMPLEMENT_STACK_OF(X509_NAME)
    813.   
    814.   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:812:1: return from a call to sk_X509_NAME_set_cmp_func
    810.   IMPLEMENT_ASN1_SET_OF(X509)
    811.   
    812. > IMPLEMENT_STACK_OF(X509_NAME)
    813.   
    814.   IMPLEMENT_STACK_OF(X509_ATTRIBUTE)

ssl/ssl_cert.c:656:5: 
  654.       oldcmp=sk_X509_NAME_set_cmp_func(stack,xname_cmp);
  655.   
  656. >     in=BIO_new(BIO_s_file_internal());
  657.   
  658.       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: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, const char *file, int line)
      195.   	{
      196.   	char *ret = NULL;

crypto/mem.c:196:2: 
      194.   void *CRYPTO_malloc(int num, const 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, const 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:350:1: start of procedure ERR_put_error()
      348.   /********************************************************/
      349.   
      350. > void ERR_put_error(int lib, int func, int reason, const char *file,
      351.   	     int line)
      352.   	{

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

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

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

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

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

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

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

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

crypto/err/err.c:383:2: return from a call to ERR_put_error
      381.   	es->err_line[es->top]=line;
      382.   	err_clear_data(es,es->top);
      383.   	}
              ^
      384.   
      385.   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:658:9: Taking true branch
  656.       in=BIO_new(BIO_s_file_internal());
  657.   
  658.       if (in == NULL)
                 ^
  659.   	{
  660.   	SSLerr(SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK,ERR_R_MALLOC_FAILURE);

ssl/ssl_cert.c:660:2: 
  658.       if (in == NULL)
  659.   	{
  660. > 	SSLerr(SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK,ERR_R_MALLOC_FAILURE);
  661.   	goto err;
  662.   	}

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

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

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

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

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

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

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

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

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

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

ssl/ssl_cert.c:682:1: 
  680.       if (0)
  681.   	{
  682. > err:
  683.   	ret=0;
  684.   	}

ssl/ssl_cert.c:683:2: 
  681.   	{
  682.   err:
  683. > 	ret=0;
  684.   	}
  685.       if(in != NULL)

ssl/ssl_cert.c:685:8: Taking false branch
  683.   	ret=0;
  684.   	}
  685.       if(in != NULL)
                ^
  686.   	BIO_free(in);
  687.       if(x != NULL)

ssl/ssl_cert.c:687:8: Taking false branch
  685.       if(in != NULL)
  686.   	BIO_free(in);
  687.       if(x != NULL)
                ^
  688.   	X509_free(x);
  689.   

ssl/ssl_cert.c:690:5: 
  688.   	X509_free(x);
  689.   
  690. >     sk_X509_NAME_set_cmp_func(stack,oldcmp);
  691.   
  692.       return ret;

crypto/x509/x509_vfy.c:812:1: start of procedure sk_X509_NAME_set_cmp_func()
    810.   IMPLEMENT_ASN1_SET_OF(X509)
    811.   
    812. > IMPLEMENT_STACK_OF(X509_NAME)
    813.   
    814.   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:812:1: return from a call to sk_X509_NAME_set_cmp_func
    810.   IMPLEMENT_ASN1_SET_OF(X509)
    811.   
    812. > IMPLEMENT_STACK_OF(X509_NAME)
    813.   
    814.   IMPLEMENT_STACK_OF(X509_ATTRIBUTE)

ssl/ssl_cert.c:692:5: 
  690.       sk_X509_NAME_set_cmp_func(stack,oldcmp);
  691.   
  692. >     return ret;
  693.       }
  694.   

ssl/ssl_cert.c:693:5: return from a call to SSL_add_file_cert_subjects_to_stack
  691.   
  692.       return ret;
  693.       }
             ^
  694.   
  695.   /*!

ssl/ssl_cert.c:740:6: Taking true branch
738.   	
739.   	sprintf(buf,"%s/%s",dir,dstruct->d_name);
740.   	if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
            ^
741.   	    goto err;
742.   	}
