svg2png: avoid a few lines of spurious valgrand output re: still reachable xml2 parser structures

This commit is contained in:
Dane Springmeyer 2012-04-11 10:17:03 -07:00
parent b22d043d80
commit 14841f6931

View file

@ -44,6 +44,8 @@
#include "agg_pixfmt_rgba.h" #include "agg_pixfmt_rgba.h"
#include "agg_scanline_u.h" #include "agg_scanline_u.h"
#include <libxml/parser.h> // for xmlInitParser(), xmlCleanupParser()
int main (int argc,char** argv) int main (int argc,char** argv)
{ {
@ -51,6 +53,7 @@ int main (int argc,char** argv)
bool verbose=false; bool verbose=false;
std::vector<std::string> svg_files; std::vector<std::string> svg_files;
xmlInitParser();
try try
{ {
@ -149,7 +152,7 @@ int main (int argc,char** argv)
#ifdef DARWIN #ifdef DARWIN
std::ostringstream s; std::ostringstream s;
s << "open " << svg_name; s << "open " << svg_name;
system(s.str().c_str()); //system(s.str().c_str());
#endif #endif
std::clog << "rendered to: " << svg_name << "\n"; std::clog << "rendered to: " << svg_name << "\n";
} }
@ -159,9 +162,15 @@ int main (int argc,char** argv)
catch (...) catch (...)
{ {
std::clog << "Exception of unknown type!" << std::endl; std::clog << "Exception of unknown type!" << std::endl;
xmlCleanupParser();
return -1; return -1;
} }
// only call this once, on exit
// to make sure valgrind output is clean
// http://xmlsoft.org/xmlmem.html
xmlCleanupParser();
return 0; return 0;
} }