From 6732cb01a8e75a3ed577cb17bf1357bfe81a6db3 Mon Sep 17 00:00:00 2001 From: "roberto@precise64" Date: Sun, 26 Feb 2012 08:05:39 +0100 Subject: [PATCH] free libxml2 resources on exit --- setup.py | 2 ++ xmlconf.c | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 4eb1604f..c263d97e 100644 --- a/setup.py +++ b/setup.py @@ -92,6 +92,8 @@ setup(name='uWSGI', author='Unbit', author_email='info@unbit.it', url='http://projects.unbit.it/uwsgi/', + download_url='http://projects.unbit.it/downloads/uwsgi-%s.tar.gz' + % (uc.uwsgi_version), license='GPL2', py_modules=['uwsgidecorators'], distclass=uWSGIDistribution, diff --git a/xmlconf.c b/xmlconf.c index 0c22c234..4637832e 100644 --- a/xmlconf.c +++ b/xmlconf.c @@ -83,7 +83,7 @@ void uwsgi_xml_config(char *filename, struct wsgi_request *wsgi_req, char *magic for (node = element->children; node; node = node->next) { if (node->type == XML_CDATA_SECTION_NODE) { if (node->content) { - uwsgi_manage_opt("eval", (char *) node->content); + add_exported_option((char *) "eval", strdup((char *) node->content), 0); } } else if (node->type == XML_ELEMENT_NODE) { @@ -103,16 +103,20 @@ void uwsgi_xml_config(char *filename, struct wsgi_request *wsgi_req, char *magic } if (node->children) { - add_exported_option((char *) node->name, (char *) node->children->content, 0); + add_exported_option(strdup((char *) node->name), strdup((char *) node->children->content), 0); } else { - add_exported_option((char *) node->name, strdup("1"), 0); + add_exported_option(strdup((char *) node->name), strdup("1"), 0); } } } - } + /* We can safely free resources */ + + xmlFreeDoc(doc); + xmlCleanupParser(); + +} - /* We cannot free xml resources on the first round (and with routing enabled) as the string pointer must be valid for all the server lifecycle */ #endif