From: Anthony Minessale Date: Wed, 25 Feb 2009 02:22:07 +0000 (+0000) Subject: FSCORE-309 X-Git-Tag: v1.0.4~1835 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a520847c2879c0e56a41e8d4d2ed58ffaf00338;p=thirdparty%2Ffreeswitch.git FSCORE-309 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12270 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- diff --git a/src/switch_xml.c b/src/switch_xml.c index 592cb7ff7f..33de29b110 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -1554,9 +1554,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate(const char *section, if ((conf = switch_xml_find_child(xml, "section", "name", section)) && (tag = switch_xml_find_child(conf, tag_name, key_name, key_value))) { if (clone) { char *x; - switch_mutex_lock(XML_GEN_LOCK); x = switch_xml_toxml(tag, SWITCH_FALSE); - switch_mutex_unlock(XML_GEN_LOCK); switch_assert(x); *root = switch_xml_parse_str(x, strlen(x)); *node = *root; @@ -2112,9 +2110,12 @@ static char *switch_xml_toxml_r(switch_xml_t xml, char **s, switch_size_t *len, SWITCH_DECLARE(char *) switch_xml_toxml(switch_xml_t xml, switch_bool_t prn_header) { - char *s; + char *r, *s; + switch_mutex_lock(XML_GEN_LOCK); s = (char *)malloc(SWITCH_XML_BUFSIZE); - return switch_xml_toxml_buf(xml, s, SWITCH_XML_BUFSIZE, 0, prn_header); + r = switch_xml_toxml_buf(xml, s, SWITCH_XML_BUFSIZE, 0, prn_header); + switch_mutex_unlock(XML_GEN_LOCK); + return r; } // converts an switch_xml structure back to xml, returning a string of xml date that