httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <joe+gm...@sunstarsys.com>
Subject Re: Newbie: Question
Date Thu, 29 Jun 2006 19:00:32 GMT
"Edward L. Abrams" <abrams@bitscrap.com> writes:

> Thank you very much.  Is the following too loose:
>
>      for (b = APR_BRIGADE_FIRST(bb);
>           b != APR_BRIGADE_SENTINEL(bb);
>           b = APR_BUCKET_NEXT(b))
>        {
>          if (APR_BUCKET_IS_EOS(b))
>            {
>              break;
>            }

I don't think we have eos buckets in the upload brigade.

>          else if (apr_bucket_read(b, &buf, &bytes, APR_BLOCK_READ) ==
> APR_SUCCESS)
>            {
>              // We have a bucket full of raw data
>              apr_file_write(f, buf, &bytes);
>              filesize += bytes;
>              apr_bucket_delete(b);

I don't like calling APR_BUCKET_NEXT on a deleted bucket.
IMO deleting a bucket is like calling free on it, so it
should be considered a dead pointer at this point.

> Also, a last question: when dealing with file buckets, I understand
> that heap buckets are created as the file is read.  That closely
> corresponds with what you say below.  So my question is: does this
> mean there is more cleanup that has to be done wrt the brigade
> file->upload, the file bucket brigade? 


apreq cleans up its brigades after the request is over.
It shouldn't leak anything comparable to the upload size,
since we use spool (essentially file) buckets to hold that
data.

-- 
Joe Schaefer


Mime
View raw message