manoj       99/11/03 23:26:22

  Modified:    src/lib/apr/file_io/unix dir.c
               src/lib/apr/locks/unix locks.c
               src/lib/apr/misc/unix start.c
               src/lib/apr/threadproc/unix proc.c
  Log:
  Fix memory leaks in the Unix portions of APR.
  
  Revision  Changes    Path
  1.15      +1 -1      apache-2.0/src/lib/apr/file_io/unix/dir.c
  
  Index: dir.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/dir.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -d -u -r1.14 -r1.15
  --- dir.c     1999/10/31 16:18:36     1.14
  +++ dir.c     1999/11/04 07:26:20     1.15
  @@ -86,7 +86,7 @@
       (*new) = (struct dir_t *)ap_palloc(cont, sizeof(struct dir_t));
   
       (*new)->cntxt = cont;
  -    (*new)->dirname = strdup(dirname);
  +    (*new)->dirname = ap_pstrdup(cont, dirname);
       (*new)->dirstruct = opendir(dirname);
       (*new)->entry = ap_pcalloc(cont, sizeof(struct dirent));
   
  
  
  
  1.12      +2 -2      apache-2.0/src/lib/apr/locks/unix/locks.c
  
  Index: locks.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/locks/unix/locks.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -d -u -r1.11 -r1.12
  --- locks.c   1999/10/21 14:31:20     1.11
  +++ locks.c   1999/11/04 07:26:20     1.12
  @@ -88,10 +88,10 @@
       new->cntxt = cont;
       new->type = type;
       if (fname != NULL) {
  -        new->fname = strdup(fname);
  +        new->fname = ap_pstrdup(cont, fname);
       }
       else {
  -        new->fname = strdup(tempnam(NULL, NULL));
  +        new->fname = ap_pstrdup(cont, tempnam(NULL, NULL));
           unlink(new->fname);
       }
   
  
  
  
  1.12      +2 -7      apache-2.0/src/lib/apr/misc/unix/start.c
  
  Index: start.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/misc/unix/start.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -d -u -r1.11 -r1.12
  --- start.c   1999/10/13 09:31:36     1.11
  +++ start.c   1999/11/04 07:26:21     1.12
  @@ -92,12 +92,7 @@
           return APR_ENOPOOL;
       }   
   
  -    if (cont) { 
  -        new = (struct context_t *)ap_palloc(cont, sizeof(struct context_t));
  -    }
  -    else {
  -        new = (struct context_t *)malloc(sizeof(struct context_t));
  -    }
  +    new = (struct context_t *)ap_palloc(cont, sizeof(struct context_t));
   
       new->pool = pool;
       new->prog_data = NULL;
  @@ -150,7 +145,7 @@
           if (dptr == NULL) {
               dptr = ap_palloc(cont, sizeof(datastruct));
               dptr->next = dptr->prev = NULL;
  -            dptr->key = strdup(key);
  +            dptr->key = ap_pstrdup(cont, key);
               if (dptr2) {
                   dptr2->next = dptr;
                   dptr->prev = dptr2;
  
  
  
  1.10      +8 -6      apache-2.0/src/lib/apr/threadproc/unix/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/unix/proc.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -d -u -r1.9 -r1.10
  --- proc.c    1999/11/03 07:29:06     1.9
  +++ proc.c    1999/11/04 07:26:22     1.10
  @@ -305,7 +305,8 @@
                                 struct procattr_t *attr, ap_context_t *cont)
   {
       int i;
  -    char **newargs;
  +    typedef const char *my_stupid_string;
  +    my_stupid_string *newargs;
       struct proc_t *pgrp; 
   
       (*new) = (struct proc_t *)ap_palloc(cont, sizeof(struct proc_t));
  @@ -352,19 +353,20 @@
               while (args[i]) {
                   i++;
               }
  -            newargs = (char **)ap_palloc(cont, sizeof (char *) * (i + 3));
  -            newargs[0] = strdup(SHELL_PATH);
  -            newargs[1] = strdup("-c");
  +            newargs =
  +               (my_stupid_string *) ap_palloc(cont, sizeof (char *) * (i + 
3));
  +            newargs[0] = SHELL_PATH;
  +            newargs[1] = "-c";
               i = 0;
               while (args[i]) {
  -                newargs[i + 2] = strdup(args[i]); 
  +                newargs[i + 2] = args[i]; 
                   i++;
               }
               newargs[i + 3] = NULL;
               if (attr->detached) {
                   ap_detach(&pgrp, attr->cntxt);
               }
  -            execve(SHELL_PATH, newargs, env);
  +            execve(SHELL_PATH, (char **) newargs, env);
           }
           else {
               if (attr->detached) {
  
  
  

Reply via email to