httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@hyperreal.org
Subject cvs commit: apache-2.0/src/modules/standard mod_asis.c mod_autoindex.c mod_cgi.c mod_cgid.c mod_include.c mod_mime_magic.c mod_negotiation.c mod_rewrite.c
Date Tue, 04 Jan 2000 19:01:14 GMT
rbb         00/01/04 11:01:13

  Modified:    src/lib/apr/file_io/unix filestat.c open.c
               src/lib/apr/include apr_file_io.h
               src/lib/apr/test abc.c testfile.c testmmap.c testproc.c
               src/main buff.c http_config.c http_log.c util.c
               src/modules/experimental mod_mmap_static.c
               src/modules/mpm/prefork prefork.c
               src/modules/standard mod_asis.c mod_autoindex.c mod_cgi.c
                        mod_cgid.c mod_include.c mod_mime_magic.c
                        mod_negotiation.c mod_rewrite.c
  Log:
  Initialize all ap_file_t's to NULL.  This allows ap_open and ap_stat to
  work together without causing memory leaks.
  
  Revision  Changes    Path
  1.5       +1 -1      apache-2.0/src/lib/apr/file_io/unix/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/filestat.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- filestat.c	2000/01/03 20:57:20	1.4
  +++ filestat.c	2000/01/04 19:00:42	1.5
  @@ -92,7 +92,7 @@
    * arg 2) The name of the file to stat.
    * arg 3) the context to use to allocate the new file. 
    */ 
  -ap_status_t ap_stat(struct file_t **thefile, char *fname, ap_context_t *cont)
  +ap_status_t ap_stat(struct file_t **thefile, const char *fname, ap_context_t *cont)
   {
       struct stat info;
       int rv = stat(fname, &info);
  
  
  
  1.30      +3 -1      apache-2.0/src/lib/apr/file_io/unix/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/open.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- open.c	1999/12/31 01:16:53	1.29
  +++ open.c	2000/01/04 19:00:42	1.30
  @@ -104,7 +104,9 @@
       int oflags = 0;
       char *buf_oflags;
   
  -    (*new) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t));
  +    if ((*new) == NULL) {
  +        (*new) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t));
  +    }
   
       (*new)->cntxt = cont;
       (*new)->oflags = oflags;
  
  
  
  1.25      +1 -1      apache-2.0/src/lib/apr/include/apr_file_io.h
  
  Index: apr_file_io.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_file_io.h,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- apr_file_io.h	2000/01/03 19:47:44	1.24
  +++ apr_file_io.h	2000/01/04 19:00:44	1.25
  @@ -132,7 +132,7 @@
   ap_status_t ap_make_iov(ap_iovec_t **, struct iovec *, ap_context_t *);
   ap_status_t ap_dupfile(ap_file_t **, ap_file_t *);
   ap_status_t ap_getfileinfo(ap_file_t *);
  -ap_status_t ap_stat(ap_file_t **thefile, char *fname, ap_context_t *cont);
  +ap_status_t ap_stat(ap_file_t **thefile, const char *fname, ap_context_t *cont);
   ap_status_t ap_seek(ap_file_t *, ap_seek_where_t, ap_off_t *);
   
   ap_status_t ap_opendir(ap_dir_t **, const char *, ap_context_t *);
  
  
  
  1.6       +1 -1      apache-2.0/src/lib/apr/test/abc.c
  
  Index: abc.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/abc.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- abc.c	1999/10/14 14:36:35	1.5
  +++ abc.c	2000/01/04 19:00:47	1.6
  @@ -6,7 +6,7 @@
   
   int main(int argc, char *argv[])
   {
  -    ap_file_t *fd;
  +    ap_file_t *fd = NULL;
       char ch;
       int status = 0;
       ap_context_t *context;
  
  
  
  1.8       +2 -2      apache-2.0/src/lib/apr/test/testfile.c
  
  Index: testfile.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/testfile.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- testfile.c	1999/10/15 14:20:19	1.7
  +++ testfile.c	2000/01/04 19:00:49	1.8
  @@ -210,7 +210,7 @@
   
   int test_filedel(ap_context_t *context)
   {
  -    ap_file_t *thefile;
  +    ap_file_t *thefile = NULL;
       ap_int32_t flag = APR_READ | APR_WRITE | APR_CREATE;
       ap_status_t stat;
     
  @@ -238,7 +238,7 @@
   int testdirs(ap_context_t *context)
   {
       ap_dir_t *temp;  
  -    ap_file_t *file;
  +    ap_file_t *file = NULL;
       ap_ssize_t bytes;
       ap_filetype_e type;
       char *fname;
  
  
  
  1.5       +1 -1      apache-2.0/src/lib/apr/test/testmmap.c
  
  Index: testmmap.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/testmmap.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- testmmap.c	1999/12/15 12:20:40	1.4
  +++ testmmap.c	2000/01/04 19:00:49	1.5
  @@ -70,7 +70,7 @@
   {
       ap_context_t *context;
       ap_mmap_t *themmap = NULL;
  -    ap_file_t *thefile;
  +    ap_file_t *thefile = NULL;
       ap_int32_t flag = APR_READ;
       char *file1;
       ap_ssize_t filesize;
  
  
  
  1.9       +1 -1      apache-2.0/src/lib/apr/test/testproc.c
  
  Index: testproc.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/testproc.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- testproc.c	1999/12/30 19:45:38	1.8
  +++ testproc.c	2000/01/04 19:00:49	1.9
  @@ -73,7 +73,7 @@
       ap_context_t *context;
       ap_proc_t *newproc;
       ap_procattr_t *attr;
  -    ap_file_t *testfile;
  +    ap_file_t *testfile = NULL;
       ap_ssize_t length;
       char *buf;
       char *args[3];
  
  
  
  1.27      +1 -1      apache-2.0/src/main/buff.c
  
  Index: buff.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/buff.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- buff.c	1999/12/19 10:05:08	1.26
  +++ buff.c	2000/01/04 19:00:52	1.27
  @@ -1000,7 +1000,7 @@
       ap_iol *iol;
       BUFF *fb;
       ap_status_t rv;
  -    ap_file_t *file;
  +    ap_file_t *file = NULL;
       rv = ap_open(&file, name, flg, 0, a);
       if ((rv != APR_SUCCESS) || (file == NULL)) {
           return NULL;
  
  
  
  1.21      +3 -3      apache-2.0/src/main/http_config.c
  
  Index: http_config.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_config.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- http_config.c	1999/12/11 20:29:17	1.20
  +++ http_config.c	2000/01/04 19:00:52	1.21
  @@ -1021,20 +1021,20 @@
   {
       const char *errmsg;
       cmd_parms parms;
  -    struct stat finfo;
  +    ap_file_t *finfo = NULL;
   
       fname = ap_server_root_relative(p, fname);
   
       if (!(strcmp(fname, ap_server_root_relative(p, RESOURCE_CONFIG_FILE))) ||
   	!(strcmp(fname, ap_server_root_relative(p, ACCESS_CONFIG_FILE)))) {
  -	if (stat(fname, &finfo) == -1)   
  +	if (ap_stat(&finfo, fname, ptemp) != APR_SUCCESS)   
   	    return;
       }
   
       /* don't require conf/httpd.conf if we have a -C or -c switch */
       if((ap_server_pre_read_config->nelts || ap_server_post_read_config->nelts) &&
          !(strcmp(fname, ap_server_root_relative(p, SERVER_CONFIG_FILE)))) {
  -	if (stat(fname, &finfo) == -1)     
  +	if (ap_stat(&finfo, fname, ptemp) != APR_SUCCESS)     
   	    return;
       }
   
  
  
  
  1.23      +5 -6      apache-2.0/src/main/http_log.c
  
  Index: http_log.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_log.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- http_log.c	1999/12/13 20:52:26	1.22
  +++ http_log.c	2000/01/04 19:00:53	1.23
  @@ -204,7 +204,7 @@
       int rc;
   
       if (*s->error_fname == '|') {
  -	ap_file_t *dummy;
  +	ap_file_t *dummy = NULL;
   
           /* This starts a new process... */
           rc = log_child (p, s->error_fname+1, &dummy);
  @@ -299,7 +299,7 @@
   }
   
   API_EXPORT(void) ap_error_log2stderr(server_rec *s) {
  -    ap_file_t *errfile;
  +    ap_file_t *errfile = NULL;
   
       ap_open_stderr(&errfile, s->process->pool);        
       if (   s->error_log != NULL) {
  @@ -513,8 +513,7 @@
   
   void ap_log_pid(ap_context_t *p, const char *fname)
   {
  -    ap_file_t *pid_file;
  -    struct stat finfo;
  +    ap_file_t *pid_file = NULL;
       static pid_t saved_pid = -1;
       pid_t mypid;
   
  @@ -523,7 +522,7 @@
   
       fname = ap_server_root_relative(p, fname);
       mypid = getpid();
  -    if (mypid != saved_pid && stat(fname, &finfo) == 0) {
  +    if (mypid != saved_pid && ap_stat(&pid_file, fname, p) == 0) {
         /* WINCH and HUP call this on each restart.
          * Only warn on first time through for this pid.
          *
  @@ -740,7 +739,7 @@
   API_EXPORT(piped_log *) ap_open_piped_log(ap_context_t *p, const char *program)
   {
       piped_log *pl;
  -    ap_file_t *dummy;
  +    ap_file_t *dummy = NULL;
       int rc;
   
       rc = log_child(p, program, &dummy);
  
  
  
  1.23      +1 -1      apache-2.0/src/main/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- util.c	1999/12/30 18:31:28	1.22
  +++ util.c	2000/01/04 19:00:53	1.23
  @@ -765,7 +765,7 @@
   API_EXPORT(ap_status_t) ap_pcfg_openfile(configfile_t **ret_cfg, ap_context_t *p, const
char *name)
   {
       configfile_t *new_cfg;
  -    ap_file_t *file;
  +    ap_file_t *file = NULL;
       ap_status_t stat;
       ap_filetype_e type;
   
  
  
  
  1.6       +1 -1      apache-2.0/src/modules/experimental/mod_mmap_static.c
  
  Index: mod_mmap_static.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/experimental/mod_mmap_static.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- mod_mmap_static.c	1999/11/20 12:55:26	1.5
  +++ mod_mmap_static.c	2000/01/04 19:00:56	1.6
  @@ -167,7 +167,7 @@
       a_server_config *sconf;
       a_file *new_file;
       a_file tmp;
  -    ap_file_t *fd;
  +    ap_file_t *fd = NULL;
       caddr_t mm;
   
       if (stat(filename, &tmp.finfo) == -1) {
  
  
  
  1.63      +3 -3      apache-2.0/src/modules/mpm/prefork/prefork.c
  
  Index: prefork.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- prefork.c	1999/12/31 20:32:34	1.62
  +++ prefork.c	2000/01/04 19:00:57	1.63
  @@ -548,7 +548,7 @@
    */
   static void accept_mutex_init(ap_context_t *p)
   {
  -    ap_file_t *tempfile;
  +    ap_file_t *tempfile = NULL;
       lock_it.l_whence = SEEK_SET;	/* from current point */
       lock_it.l_start = 0;		/* -"- */
       lock_it.l_len = 0;			/* until end of file */
  @@ -623,7 +623,7 @@
    */
   static void accept_mutex_child_init(ap_context_t *p)
   {
  -    ap_file_t *tempfile;
  +    ap_file_t *tempfile = NULL;
       ap_status_t ret;
   
       ret=ap_open(&tempfile, ap_lock_fname, APR_WRITE, APR_UREAD|APR_UWRITE, p);
  @@ -641,7 +641,7 @@
    */
   static void accept_mutex_init(ap_context_t *p)
   {
  -    ap_file_t *tempfile;
  +    ap_file_t *tempfile = NULL;
       ap_status_t ret;
   
       expand_lock_fname(p);
  
  
  
  1.13      +1 -1      apache-2.0/src/modules/standard/mod_asis.c
  
  Index: mod_asis.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_asis.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- mod_asis.c	1999/11/01 04:27:05	1.12
  +++ mod_asis.c	2000/01/04 19:01:00	1.13
  @@ -65,7 +65,7 @@
   
   static int asis_handler(request_rec *r)
   {
  -    ap_file_t *f;
  +    ap_file_t *f = NULL;
       ap_status_t status;
       const char *location;
   
  
  
  
  1.15      +2 -2      apache-2.0/src/modules/standard/mod_autoindex.c
  
  Index: mod_autoindex.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_autoindex.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- mod_autoindex.c	1999/11/23 13:47:01	1.14
  +++ mod_autoindex.c	2000/01/04 19:01:01	1.15
  @@ -939,7 +939,7 @@
   static void emit_head(request_rec *r, char *header_fname, int suppress_amble,
   		      char *title)
   {
  -    ap_file_t *f;
  +    ap_file_t *f = NULL;
       request_rec *rr = NULL;
       int emit_amble = 1;
       int emit_H1 = 1;
  @@ -1022,7 +1022,7 @@
    */
   static void emit_tail(request_rec *r, char *readme_fname, int suppress_amble)
   {
  -    ap_file_t *f;
  +    ap_file_t *f = NULL;
       request_rec *rr = NULL;
       int suppress_post = 0;
       int suppress_sig = 0;
  
  
  
  1.22      +3 -3      apache-2.0/src/modules/standard/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_cgi.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- mod_cgi.c	1999/12/14 20:37:58	1.21
  +++ mod_cgi.c	2000/01/04 19:01:01	1.22
  @@ -166,7 +166,7 @@
   static int log_scripterror(request_rec *r, cgi_server_conf * conf, int ret,
   			   int show_errno, char *error)
   {
  -    ap_file_t *f;
  +    ap_file_t *f = NULL;
       struct stat finfo;
   
       ap_log_rerror(APLOG_MARK, show_errno|APLOG_ERR, errno, r, 
  @@ -198,7 +198,7 @@
       ap_array_header_t *hdrs_arr = ap_table_elts(r->headers_in);
       ap_table_entry_t *hdrs = (ap_table_entry_t *) hdrs_arr->elts;
       char argsbuffer[HUGE_STRING_LEN];
  -    ap_file_t *f;
  +    ap_file_t *f = NULL;
       int i;
       struct stat finfo;
   
  @@ -285,7 +285,7 @@
       ap_procattr_t *procattr;
       ap_proc_t *procnew;
       ap_status_t rc = APR_SUCCESS;
  -    ap_file_t *file;
  +    ap_file_t *file = NULL;
       ap_iol *iol;
   
   #ifdef DEBUG_CGI
  
  
  
  1.2       +2 -2      apache-2.0/src/modules/standard/mod_cgid.c
  
  Index: mod_cgid.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_cgid.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mod_cgid.c	1999/11/19 20:22:51	1.1
  +++ mod_cgid.c	2000/01/04 19:01:01	1.2
  @@ -666,7 +666,7 @@
   static int log_scripterror(request_rec *r, cgid_server_conf * conf, int ret, 
                              int show_errno, char *error) 
   { 
  -    ap_file_t *f; 
  +    ap_file_t *f = NULL; 
       struct stat finfo; 
   
       ap_log_rerror(APLOG_MARK, show_errno|APLOG_ERR, errno, r, 
  @@ -698,7 +698,7 @@
       ap_array_header_t *hdrs_arr = ap_table_elts(r->headers_in); 
       ap_table_entry_t *hdrs = (ap_table_entry_t *) hdrs_arr->elts; 
       char argsbuffer[HUGE_STRING_LEN]; 
  -    ap_file_t *f; 
  +    ap_file_t *f = NULL; 
       int i; 
       struct stat finfo; 
   
  
  
  
  1.14      +2 -2      apache-2.0/src/modules/standard/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_include.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- mod_include.c	1999/12/20 16:38:39	1.13
  +++ mod_include.c	2000/01/04 19:01:02	1.14
  @@ -823,7 +823,7 @@
       ap_status_t rc;
       ap_table_t *env = r->subprocess_env;
       char **argv;
  -    ap_file_t *file;
  +    ap_file_t *file = NULL;
       ap_iol *iol;
   
       arg.r = r;
  @@ -2347,7 +2347,7 @@
   
   static int send_parsed_file(request_rec *r)
   {
  -    ap_file_t *f;
  +    ap_file_t *f = NULL;
       enum xbithack *state =
       (enum xbithack *) ap_get_module_config(r->per_dir_config, &includes_module);
       int errstatus;
  
  
  
  1.11      +2 -2      apache-2.0/src/modules/standard/mod_mime_magic.c
  
  Index: mod_mime_magic.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_mime_magic.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- mod_mime_magic.c	1999/12/13 20:52:28	1.10
  +++ mod_mime_magic.c	2000/01/04 19:01:02	1.11
  @@ -935,7 +935,7 @@
    */
   static int apprentice(server_rec *s, ap_context_t *p)
   {
  -    ap_file_t *f;
  +    ap_file_t *f = NULL;
       ap_status_t result;
       char line[BUFSIZ + 1];
       int errs = 0;
  @@ -2153,7 +2153,7 @@
       ap_context_t *child_context = cntxt;
       ap_procattr_t *procattr;
       ap_proc_t *procnew = NULL;
  -    ap_file_t *file;
  +    ap_file_t *file = NULL;
       ap_iol *iol;
   
       ap_block_alarms();
  
  
  
  1.14      +1 -1      apache-2.0/src/modules/standard/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_negotiation.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- mod_negotiation.c	1999/12/20 16:38:39	1.13
  +++ mod_negotiation.c	2000/01/04 19:01:04	1.14
  @@ -776,7 +776,7 @@
   static int read_type_map(negotiation_state *neg, request_rec *rr)
   {
       request_rec *r = neg->r;
  -    ap_file_t *map;
  +    ap_file_t *map = NULL;
       ap_status_t status;
       char buffer[MAX_STRING_LEN];
       enum header_state hstate;
  
  
  
  1.8       +3 -3      apache-2.0/src/modules/standard/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_rewrite.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- mod_rewrite.c	1999/12/31 05:05:27	1.7
  +++ mod_rewrite.c	2000/01/04 19:01:04	1.8
  @@ -3394,9 +3394,9 @@
   static void run_rewritemap_programs(server_rec *s, ap_context_t *p)
   {
       rewrite_server_conf *conf;
  -    ap_file_t *fpin;
  -    ap_file_t *fpout;
  -    ap_file_t *fperr;
  +    ap_file_t *fpin = NULL;
  +    ap_file_t *fpout = NULL;
  +    ap_file_t *fperr = NULL;
       ap_array_header_t *rewritemaps;
       rewritemap_entry *entries;
       rewritemap_entry *map;
  
  
  

Mime
View raw message