You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Cliff Woolley <JW...@wlu.edu> on 2000/07/21 23:22:34 UTC

[PATCH] buckets: fix a memory leak and a typo

Two minor changes to the buckets code.  The first change fixes a subtle
memory leak: one extra bucket was being created even though there was
nothing to put in it, and since it was never being linked into the
brigade, it would never be destroyed.  The second change just removes an
extra semicolon.

--Cliff


? Makefile.in
cvs server: Diffing .
Index: ap_buf.c
===================================================================
RCS file: /home/cvspublic/apache-2.0/src/lib/apr/buckets/ap_buf.c,v
retrieving revision 1.15
diff -u -r1.15 ap_buf.c
--- ap_buf.c    2000/07/20 16:14:24     1.15
+++ ap_buf.c    2000/07/21 21:15:10
@@ -253,12 +253,12 @@
     }

     for (k = 0;;) {
-        r = ap_bucket_rwmem_create();
         x = va_arg(va, const char *);
         if (x == NULL)
             break;
         j = strlen(x);

+        r = ap_bucket_rwmem_create();
         rv = r->insert(r, x, j, &i);
         if (i != j) {
             /* Do we need better error reporting?  */
Index: ap_mmap_buf.c
===================================================================
RCS file: /home/cvspublic/apache-2.0/src/lib/apr/buckets/ap_mmap_buf.c,v
retrieving revision 1.7
diff -u -r1.7 ap_mmap_buf.c
--- ap_mmap_buf.c       2000/07/20 16:14:24     1.7
+++ ap_mmap_buf.c       2000/07/21 21:15:10
@@ -77,7 +77,7 @@
     ap_bucket_mmap *b = (ap_bucket_mmap *)e->data;
     ap_mmap_t *mm = (ap_mmap_t *)buf;

-    b->alloc_addr = mm->mm;;
+    b->alloc_addr = mm->mm;
     b->len = nbytes;
     *w = nbytes;
     return APR_SUCCESS;

Re: [PATCH] buckets: fix a memory leak and a typo

Posted by rb...@covalent.net.
Both have been patched now.  Thanks.

Ryan

On Fri, 21 Jul 2000, Cliff Woolley wrote:

> 
> Two minor changes to the buckets code.  The first change fixes a subtle
> memory leak: one extra bucket was being created even though there was
> nothing to put in it, and since it was never being linked into the
> brigade, it would never be destroyed.  The second change just removes an
> extra semicolon.
> 
> --Cliff
> 
> 
> ? Makefile.in
> cvs server: Diffing .
> Index: ap_buf.c
> ===================================================================
> RCS file: /home/cvspublic/apache-2.0/src/lib/apr/buckets/ap_buf.c,v
> retrieving revision 1.15
> diff -u -r1.15 ap_buf.c
> --- ap_buf.c    2000/07/20 16:14:24     1.15
> +++ ap_buf.c    2000/07/21 21:15:10
> @@ -253,12 +253,12 @@
>      }
> 
>      for (k = 0;;) {
> -        r = ap_bucket_rwmem_create();
>          x = va_arg(va, const char *);
>          if (x == NULL)
>              break;
>          j = strlen(x);
> 
> +        r = ap_bucket_rwmem_create();
>          rv = r->insert(r, x, j, &i);
>          if (i != j) {
>              /* Do we need better error reporting?  */
> Index: ap_mmap_buf.c
> ===================================================================
> RCS file: /home/cvspublic/apache-2.0/src/lib/apr/buckets/ap_mmap_buf.c,v
> retrieving revision 1.7
> diff -u -r1.7 ap_mmap_buf.c
> --- ap_mmap_buf.c       2000/07/20 16:14:24     1.7
> +++ ap_mmap_buf.c       2000/07/21 21:15:10
> @@ -77,7 +77,7 @@
>      ap_bucket_mmap *b = (ap_bucket_mmap *)e->data;
>      ap_mmap_t *mm = (ap_mmap_t *)buf;
> 
> -    b->alloc_addr = mm->mm;;
> +    b->alloc_addr = mm->mm;
>      b->len = nbytes;
>      *w = nbytes;
>      return APR_SUCCESS;
> 


_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------