You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ja...@apache.org on 2005/12/03 13:47:16 UTC
svn commit: r351931 -
/xerces/xerces-p/trunk/Handler/PerlEntityResolverHandler.i
Author: jasons
Date: Sat Dec 3 04:47:07 2005
New Revision: 351931
URL: http://svn.apache.org/viewcvs?rev=351931&view=rev
Log:
resolveEntity() - now returns undef if not handled by the resolver, delete char*'s returned by transcode() to avoid memory leaks
Modified:
xerces/xerces-p/trunk/Handler/PerlEntityResolverHandler.i
Modified: xerces/xerces-p/trunk/Handler/PerlEntityResolverHandler.i
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/Handler/PerlEntityResolverHandler.i?rev=351931&r1=351930&r2=351931&view=diff
==============================================================================
--- xerces/xerces-p/trunk/Handler/PerlEntityResolverHandler.i (original)
+++ xerces/xerces-p/trunk/Handler/PerlEntityResolverHandler.i Sat Dec 3 04:47:07 2005
@@ -97,12 +97,19 @@
SPAGAIN ;
+ SV* source_sv;
if (count != 1)
- croak("EntityResolver did not retury any object\n") ;
+ {
+ warn("EntityResolver did not retury any object\n");
+ source_sv = &PL_sv_undef;
+ }
+ else
+ {
+ source_sv = POPs;
+ }
- SV* source_sv = POPs;
InputSource *source;
- if (!sv_derived_from(source_sv,"XML::Xerces::InputSource")) {
+ if (count == 1 && SvOK(source_sv) && !sv_derived_from(source_sv,"XML::Xerces::InputSource")) {
croak("EntityResolver did not return an InputSource\n") ;
}
@@ -111,6 +118,12 @@
croak("EntityResolver did not return an InputSource. Expected %s", SWIGTYPE_p_XERCES_CPP_NAMESPACE__InputSource->name);
}
PUTBACK ;
+
+
+ // transcode mallocs this and leaves it up to us to free the memory
+ delete [] cptr1;
+ delete [] cptr2;
+
FREETMPS;
LEAVE;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org