ssl/ssl_cert.c:704: error: RESOURCE_LEAK
  resource acquired to `ret` by call to `opendir()` at line 681, column 9 is not released after line 704, column 5.
Showing all 12 steps of the trace


ssl/ssl_cert.c:673:1: start of procedure SSL_add_dir_cert_subjects_to_stack()
671.   #ifndef VMS			/* XXXX This may be fixed in the future */
672.   
673. > int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
674.   				       const char *dir)
675.       {

ssl/ssl_cert.c:678:5: 
676.       DIR *d;
677.       struct dirent *dstruct;
678. >     int ret = 0;
679.   
680.       CRYPTO_w_lock(CRYPTO_LOCK_READDIR);

ssl/ssl_cert.c:680:5: 
678.       int ret = 0;
679.   
680. >     CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
681.       d = opendir(dir);
682.   

crypto/cryptlib.c:191:1: start of procedure CRYPTO_lock()
  189.   	}
  190.   
  191. > void CRYPTO_lock(int mode, int type, const char *file, int line)
  192.   	{
  193.   #ifdef LOCK_DEBUG

crypto/cryptlib.c:216:6: Taking true branch
  214.   		}
  215.   #endif
  216.   	if (locking_callback != NULL)
              ^
  217.   		locking_callback(mode,type,file,line);
  218.   	}

crypto/cryptlib.c:217:3: Skipping __function_pointer__(): unresolved function pointer
  215.   #endif
  216.   	if (locking_callback != NULL)
  217.   		locking_callback(mode,type,file,line);
           ^
  218.   	}
  219.   

crypto/cryptlib.c:216:2: 
  214.   		}
  215.   #endif
  216. > 	if (locking_callback != NULL)
  217.   		locking_callback(mode,type,file,line);
  218.   	}

crypto/cryptlib.c:218:2: return from a call to CRYPTO_lock
  216.   	if (locking_callback != NULL)
  217.   		locking_callback(mode,type,file,line);
  218.   	}
          ^
  219.   
  220.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

ssl/ssl_cert.c:681:5: 
679.   
680.       CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
681. >     d = opendir(dir);
682.   
683.       /* Note that a side effect is that the CAs will be sorted by name */

ssl/ssl_cert.c:684:9: Taking false branch
682.   
683.       /* Note that a side effect is that the CAs will be sorted by name */
684.       if(!d)
               ^
685.   	{
686.   	SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,ERR_R_MALLOC_FAILURE);

ssl/ssl_cert.c:690:12: Loop condition is false. Leaving loop
688.   	}
689.   
690.       while((dstruct=readdir(d)))
                  ^
691.   	{
692.   	char buf[1024];

ssl/ssl_cert.c:704:5: 
702.   	    goto err;
703.   	}
704. >     ret = 1;
705.   
706.   err:	
