File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,9 @@ function libxml2.xmlNewParserCtxt()
143143 end
144144 print_dbg (" xmlNewParserCtxt: " , context )
145145 return ffi .gc (context , function (p )
146+ if p .myDoc and p .myDoc ~= ffi .NULL then
147+ xml2 .xmlFreeDoc (p .myDoc )
148+ end
146149 print_dbg (" xmlFreeParserCtxt: " , p )
147150 xml2 .xmlFreeParserCtxt (p )
148151 end )
@@ -153,7 +156,14 @@ function libxml2.xmlCreatePushParserCtxt(filename)
153156 if context == ffi .NULL then
154157 return nil
155158 end
156- return ffi .gc (context , xml2 .xmlFreeParserCtxt )
159+ print_dbg (" xmlCreatePushParserCtxt: " , context )
160+ return ffi .gc (context , function (p )
161+ if p .myDoc and p .myDoc ~= ffi .NULL then
162+ xml2 .xmlFreeDoc (p .myDoc )
163+ end
164+ print_dbg (" xmlFreeParserCtxt: " , p )
165+ xml2 .xmlFreeParserCtxt (p )
166+ end )
157167end
158168
159169local function parse_xml_parse_options (value , default )
You can’t perform that action at this time.
0 commit comments