httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@hyperreal.org
Subject cvs commit: apache-2.0/src/lib/apr/threadproc/beos proc.c
Date Fri, 05 Nov 1999 21:26:36 GMT
manoj       99/11/05 13:26:32

  Modified:    src/lib/apr/file_io/win32 dir.c open.c readdir.c
               src/lib/apr/locks/beos locks.c
               src/lib/apr/locks/win32 locks.c
               src/lib/apr/misc/beos start.c
               src/lib/apr/misc/win32 start.c
               src/lib/apr/threadproc/beos proc.c
  Log:
  Plug some memory leaks, and eliminate a little redundant code.
  
  Revision  Changes    Path
  1.7       +1 -1      apache-2.0/src/lib/apr/file_io/win32/dir.c
  
  Index: dir.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/dir.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -d -u -r1.6 -r1.7
  --- dir.c	1999/10/23 20:15:17	1.6
  +++ dir.c	1999/11/05 21:26:07	1.7
  @@ -132,7 +132,7 @@
   {
   	ap_status_t stat;
   	ap_context_t *cont = thedir->cntxt;
  -    char *temp = strdup(thedir->dirname);
  +    char *temp = ap_pstrdup(cont, thedir->dirname);
   	temp[strlen(temp) - 2] = '\0';   /*remove the \* at the end */
   	if (thedir->dirhand == INVALID_HANDLE_VALUE) {
   		return APR_SUCCESS;
  
  
  
  1.11      +1 -1      apache-2.0/src/lib/apr/file_io/win32/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/open.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -d -u -r1.10 -r1.11
  --- open.c	1999/11/03 22:01:46	1.10
  +++ open.c	1999/11/05 21:26:09	1.11
  @@ -102,7 +102,7 @@
       } else {
           (*dafile)->buffered = FALSE;
       }
  -    (*dafile)->fname = strdup(fname);
  +    (*dafile)->fname = ap_pstrdup(cont, fname);
   
       (*dafile)->demonfname = canonical_filename((*dafile)->cntxt, fname);
       (*dafile)->lowerdemonfname = strlwr((*dafile)->demonfname);
  
  
  
  1.2       +1 -0      apache-2.0/src/lib/apr/file_io/win32/readdir.c
  
  Index: readdir.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/readdir.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -d -u -r1.1 -r1.2
  --- readdir.c	1999/08/17 15:59:37	1.1
  +++ readdir.c	1999/11/05 21:26:10	1.2
  @@ -40,6 +40,7 @@
           if (errno == ENOENT)
               dp->finished = 1;
           else
  +        free(filespec)
           return NULL;
       }
   
  
  
  
  1.6       +1 -1      apache-2.0/src/lib/apr/locks/beos/locks.c
  
  Index: locks.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/locks/beos/locks.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -d -u -r1.5 -r1.6
  --- locks.c	1999/10/14 20:53:28	1.5
  +++ locks.c	1999/11/05 21:26:13	1.6
  @@ -73,7 +73,7 @@
       
       new->cntxt = cont;
       new->type = type;
  -    new->fname = strdup(fname);
  +    new->fname = ap_pstrdup(cont, fname);
   
       if (type != APR_CROSS_PROCESS) {
           if ((stat = create_intra_lock(new)) != APR_SUCCESS) {
  
  
  
  1.12      +2 -9      apache-2.0/src/lib/apr/locks/win32/locks.c
  
  Index: locks.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/locks/win32/locks.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -d -u -r1.11 -r1.12
  --- locks.c	1999/10/15 14:20:05	1.11
  +++ locks.c	1999/11/05 21:26:15	1.12
  @@ -71,10 +71,7 @@
       /* ToDo:  How to handle the case when no context is available? 
       *         How to cleanup the storage properly?
       */
  -    if (cont)
  -        newlock->fname = ap_pstrdup(cont, fname);
  -    else
  -        newlock->fname = strdup(fname);
  +    newlock->fname = ap_pstrdup(cont, fname);
       newlock->type = type;
       newlock->scope = scope;
       sec.nLength = sizeof(SECURITY_ATTRIBUTES);
  @@ -106,11 +103,7 @@
       if ((*lock) == NULL) {
           return APR_ENOMEM;
       }
  -    if (cont)
  -        (*lock)->fname = ap_pstrdup(cont, fname);
  -    else
  -        (*lock)->fname = strdup(fname);
  -
  +    (*lock)->fname = ap_pstrdup(cont, fname);
       (*lock)->mutex = OpenMutex(MUTEX_ALL_ACCESS, TRUE, fname);
       
       if ((*lock)->mutex == NULL) {
  
  
  
  1.8       +2 -7      apache-2.0/src/lib/apr/misc/beos/start.c
  
  Index: start.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/misc/beos/start.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -d -u -r1.7 -r1.8
  --- start.c	1999/10/08 20:03:57	1.7
  +++ start.c	1999/11/05 21:26:19	1.8
  @@ -79,12 +79,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;
  @@ -115,7 +110,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.9       +2 -7      apache-2.0/src/lib/apr/misc/win32/start.c
  
  Index: start.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/misc/win32/start.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -d -u -r1.8 -r1.9
  --- start.c	1999/10/12 06:14:46	1.8
  +++ start.c	1999/11/05 21:26:25	1.9
  @@ -88,12 +88,7 @@
           return APR_ENOPOOL;
       }
       
  -    if (cont) {
  -        new = (ap_context_t *)ap_palloc(cont, sizeof(ap_context_t));
  -    }
  -    else {
  -        new = (ap_context_t *)malloc(sizeof(ap_context_t));
  -    }
  +    new = (ap_context_t *)ap_palloc(cont, sizeof(ap_context_t));
       new->pool = pool;
       new->prog_data = NULL;
   
  @@ -162,7 +157,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.12      +4 -3      apache-2.0/src/lib/apr/threadproc/beos/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/beos/proc.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -d -u -r1.11 -r1.12
  --- proc.c	1999/11/03 21:47:44	1.11
  +++ proc.c	1999/11/05 21:26:29	1.12
  @@ -125,6 +125,7 @@
           strncat(cwd,"/\0",2);
           strcat(cwd,dir);
           attr->currdir = (char *)ap_pstrdup(attr->cntxt, cwd);
  +        free(cwd);
       } else {
           attr->currdir = (char *)ap_pstrdup(attr->cntxt, dir);
       }
  @@ -198,17 +199,17 @@
       }
   
   	newargs = (char**)malloc(sizeof(char *) * (i + 3));
  -	newargs[0] = strdup("/boot/home/config/bin/apr_proc_stub");
  +	newargs[0] = "/boot/home/config/bin/apr_proc_stub";
       if (attr->currdir == NULL) {
           /* we require the directory ! */
           dir = malloc(sizeof(char) * PATH_MAX);
           getcwd(dir, PATH_MAX);
  -        newargs[1] = strdup(dir);
  +        newargs[1] = dir;
           free(dir);
       } else {
   	    newargs[1] = attr->currdir;
   	}
  -	newargs[2] = strdup(progname);
  +	newargs[2] = progname;
   	i=0;nargs = 3;
   
   	while (args && args[i]) {
  
  
  

Mime
View raw message