stas 2004/01/28 18:44:33
Modified: xs/APR/Brigade APR__Brigade.h
Log:
avoid a memory leak if flatten() croaks by moving newSV until after croak.
Revision Changes Path
1.9 +2 -1 modperl-2.0/xs/APR/Brigade/APR__Brigade.h
Index: APR__Brigade.h
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/APR/Brigade/APR__Brigade.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -u -r1.8 -r1.9
--- APR__Brigade.h 29 Jan 2004 01:26:49 -0000 1.8
+++ APR__Brigade.h 29 Jan 2004 02:44:33 -0000 1.9
@@ -106,7 +106,7 @@
apr_bucket_brigade *bb;
apr_size_t length;
apr_status_t status;
- SV *data = newSV(0);
+ SV *data;
mpxs_usage_va_1(bb, "$bb->flatten([$length])");
@@ -125,6 +125,7 @@
length = (apr_size_t)actual;
}
+ data = newSV(0);
mpxs_sv_grow(data, length);
status = apr_brigade_flatten(bb, SvPVX(data), &length);