ssl/ssl_cert.c:746: error: RESOURCE_LEAK
  resource acquired to `ret` by call to `opendir()` at line 718, column 6 is not released after line 746, column 2.
Showing all 26 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:2: 
713.   	DIR *d;
714.   	struct dirent *dstruct;
715. > 	int ret = 0;
716.   
717.   	CRYPTO_w_lock(CRYPTO_LOCK_READDIR);

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

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

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

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

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

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

ssl/ssl_cert.c:718:2: 
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:6: 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:9: Loop condition is true. Entering loop body
727.   		}
728.   	
729.   	while((dstruct=readdir(d)))
               ^
730.   		{
731.   		char buf[1024];

ssl/ssl_cert.c:734:6: Taking false branch
732.   		int r;
733.   		
734.   		if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf)
            ^
735.   			{
736.   			SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG);

ssl/ssl_cert.c:740:3: 
738.   			}
739.   		
740. > 		r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name);
741.   		if (r <= 0 || r >= sizeof buf)
742.   			goto err;

crypto/bio/b_print.c:849:1: start of procedure BIO_snprintf()
  847.    * to BIO_printf, and we need *some* name prefix ...
  848.    * (XXX  the function should be renamed, but to what?) */
  849. > int BIO_snprintf(char *buf, size_t n, const char *format, ...)
  850.   	{
  851.   	va_list args;

crypto/bio/b_print.c:855:2: 
  853.   	int truncated;
  854.   
  855. > 	va_start(args, format);
  856.   	_dopr(dopr_outch, dopr_isbig, dopr_copy,
  857.   		&buf, &n, &retlen, &truncated, format, args);

crypto/bio/b_print.c:856:2: Skipping _dopr(): empty list of specs
  854.   
  855.   	va_start(args, format);
  856.   	_dopr(dopr_outch, dopr_isbig, dopr_copy,
          ^
  857.   		&buf, &n, &retlen, &truncated, format, args);
  858.   	if (truncated)

crypto/bio/b_print.c:858:6: Taking false branch
  856.   	_dopr(dopr_outch, dopr_isbig, dopr_copy,
  857.   		&buf, &n, &retlen, &truncated, format, args);
  858.   	if (truncated)
              ^
  859.   		/* In case of truncation, return -1 like traditional snprintf.
  860.   		 * (Current drafts for ISO/IEC 9899 say snprintf should return

crypto/bio/b_print.c:865:11: Condition is true
  863.   		return -1;
  864.   	else
  865.   		return (retlen <= INT_MAX) ? retlen : -1;
                   ^
  866.   	}

crypto/bio/b_print.c:865:10: 
  863.   		return -1;
  864.   	else
  865. > 		return (retlen <= INT_MAX) ? retlen : -1;
  866.   	}

crypto/bio/b_print.c:865:3: 
  863.   		return -1;
  864.   	else
  865. > 		return (retlen <= INT_MAX) ? retlen : -1;
  866.   	}

crypto/bio/b_print.c:866:2: return from a call to BIO_snprintf
  864.   	else
  865.   		return (retlen <= INT_MAX) ? retlen : -1;
  866.   	}
          ^

ssl/ssl_cert.c:741:7: Taking false branch
739.   		
740.   		r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name);
741.   		if (r <= 0 || r >= sizeof buf)
             ^
742.   			goto err;
743.   		if(!SSL_add_file_cert_subjects_to_stack(stack,buf))

ssl/ssl_cert.c:741:17: Taking false branch
739.   		
740.   		r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name);
741.   		if (r <= 0 || r >= sizeof buf)
                       ^
742.   			goto err;
743.   		if(!SSL_add_file_cert_subjects_to_stack(stack,buf))

ssl/ssl_cert.c:743:7: Taking false branch
741.   		if (r <= 0 || r >= sizeof buf)
742.   			goto err;
743.   		if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
             ^
744.   			goto err;
745.   		}

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

ssl/ssl_cert.c:746:2: 
744.   			goto err;
745.   		}
746. > 	ret = 1;
747.   
748.   err:	
