View Issue Details

IDProjectCategoryView StatusLast Update
0036248FPCPackagespublic2019-11-02 15:46
ReporterMichal GawryckiAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version3.3.1Product Build 
Target VersionFixed in Version3.3.1 
Summary0036248: libxml - xmlMemSetup should be called first
DescriptionAccording to the libxml documentation, xmlMemSetup should be called first, before any other calls to the libxml library.
http://xmlsoft.org/xmlmem.html#setting

In addition, during finalization we should call xmlCleanupParser rather than xmlMemoryDump.

Patch attached.
TagsNo tags attached.
Fixed in Revision43363
FPCOldBugId
FPCTarget3.2.0
Attached Files
  • xml2_memsetup.patch (1,028 bytes)
    Index: packages/libxml/src/xml2.pas
    ===================================================================
    --- packages/libxml/src/xml2.pas	(revision 43361)
    +++ packages/libxml/src/xml2.pas	(working copy)
    @@ -356,6 +356,11 @@
     {$ENDIF}
     
     (*
    + * overloading the memory functions
    + *)
    +  xmlMemSetup(@fpcxmlFree, @fpcxmlMalloc, @fpcxmlRealloc, @fpcxmlStrdup);
    +
    +(*
      * this initialize the library and check potential ABI mismatches
      * between the version it was compiled for and the actual shared
      * library used.
    @@ -363,11 +368,6 @@
       LIBXML_TEST_VERSION;
     
     (*
    - * overloading the memory functions
    - *)
    -  xmlMemSetup(@fpcxmlFree, @fpcxmlMalloc, @fpcxmlRealloc, @fpcxmlStrdup);
    -
    -(*
      * overloading the error functions
      *)
       //xmlSetGenericErrorFunc(nil, @fpcxmlGenericErrorHandler);
    @@ -377,11 +377,11 @@
     (*
      * Cleanup function for the XML library.
      *)
    -  //xmlCleanupParser();
    +  xmlCleanupParser();
     
     (*
      * this is to debug memory for regression tests
      *)
    -  xmlMemoryDump();
    +  //xmlMemoryDump();
     
     end.
    
    xml2_memsetup.patch (1,028 bytes)

Activities

Michal Gawrycki

2019-11-02 15:15

reporter  

xml2_memsetup.patch (1,028 bytes)
Index: packages/libxml/src/xml2.pas
===================================================================
--- packages/libxml/src/xml2.pas	(revision 43361)
+++ packages/libxml/src/xml2.pas	(working copy)
@@ -356,6 +356,11 @@
 {$ENDIF}
 
 (*
+ * overloading the memory functions
+ *)
+  xmlMemSetup(@fpcxmlFree, @fpcxmlMalloc, @fpcxmlRealloc, @fpcxmlStrdup);
+
+(*
  * this initialize the library and check potential ABI mismatches
  * between the version it was compiled for and the actual shared
  * library used.
@@ -363,11 +368,6 @@
   LIBXML_TEST_VERSION;
 
 (*
- * overloading the memory functions
- *)
-  xmlMemSetup(@fpcxmlFree, @fpcxmlMalloc, @fpcxmlRealloc, @fpcxmlStrdup);
-
-(*
  * overloading the error functions
  *)
   //xmlSetGenericErrorFunc(nil, @fpcxmlGenericErrorHandler);
@@ -377,11 +377,11 @@
 (*
  * Cleanup function for the XML library.
  *)
-  //xmlCleanupParser();
+  xmlCleanupParser();
 
 (*
  * this is to debug memory for regression tests
  *)
-  xmlMemoryDump();
+  //xmlMemoryDump();
 
 end.
xml2_memsetup.patch (1,028 bytes)

Michael Van Canneyt

2019-11-02 15:35

administrator   ~0118983

Seems correct. Applied. Please test and close if OK !

Michal Gawrycki

2019-11-02 15:46

reporter   ~0118986

Works ok. Thanks. Closed.

Issue History

Date Modified Username Field Change
2019-11-02 15:15 Michal Gawrycki New Issue
2019-11-02 15:15 Michal Gawrycki File Added: xml2_memsetup.patch
2019-11-02 15:35 Michael Van Canneyt Assigned To => Michael Van Canneyt
2019-11-02 15:35 Michael Van Canneyt Status new => resolved
2019-11-02 15:35 Michael Van Canneyt Resolution open => fixed
2019-11-02 15:35 Michael Van Canneyt Fixed in Version => 3.3.1
2019-11-02 15:35 Michael Van Canneyt Fixed in Revision => 43363
2019-11-02 15:35 Michael Van Canneyt FPCTarget => 3.2.0
2019-11-02 15:35 Michael Van Canneyt Note Added: 0118983
2019-11-02 15:46 Michal Gawrycki Status resolved => closed
2019-11-02 15:46 Michal Gawrycki Note Added: 0118986