From c66ffdf720b1c1c8ce854d3adcca4e40033655c1 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Sun, 29 Aug 2010 15:37:03 +0000 Subject: XPath: Several variable fixes git-svn-id: http://pugixml.googlecode.com/svn/trunk@678 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixml.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 366618a..c7e7fd6 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -5346,6 +5346,11 @@ namespace struct xpath_variable_string: xpath_variable { + ~xpath_variable_string() + { + if (value) global_deallocate(value); + } + char_t* value; char_t name[1]; }; @@ -5381,7 +5386,7 @@ namespace { size_t length = strlength(name); - // we can't use offsetof(T, name) because T is non-POD, so we just allocate additional length characters + // $$ we can't use offsetof(T, name) because T is non-POD, so we just allocate additional length characters void* memory = global_allocate(sizeof(T) + length * sizeof(char_t)); if (!memory) return 0; @@ -5409,7 +5414,6 @@ namespace return new_xpath_variable(name); default: - assert(false); return 0; } } -- cgit v1.2.3