diff options
Diffstat (limited to 'libxsde/xsde/cxx/serializer/non-validating/string.cxx')
-rw-r--r-- | libxsde/xsde/cxx/serializer/non-validating/string.cxx | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/libxsde/xsde/cxx/serializer/non-validating/string.cxx b/libxsde/xsde/cxx/serializer/non-validating/string.cxx index 7b1e546..1c6c50f 100644 --- a/libxsde/xsde/cxx/serializer/non-validating/string.cxx +++ b/libxsde/xsde/cxx/serializer/non-validating/string.cxx @@ -5,6 +5,10 @@ #include <xsde/cxx/serializer/non-validating/string.hxx> +#ifdef XSDE_CUSTOM_ALLOCATOR +# include <xsde/cxx/allocator.hxx> +#endif + namespace xsde { namespace cxx @@ -16,8 +20,15 @@ namespace xsde string_simpl:: ~string_simpl () { - if (free_) - delete[] const_cast<char*> (value_); + if (free_ && value_) + { + char* v = const_cast<char*> (value_); +#ifndef XSDE_CUSTOM_ALLOCATOR + delete[] v; +#else + cxx::free (v); +#endif + } } void string_simpl:: @@ -33,7 +44,12 @@ namespace xsde if (free_) { - delete[] const_cast<char*> (value_); + char* v = const_cast<char*> (value_); +#ifndef XSDE_CUSTOM_ALLOCATOR + delete[] v; +#else + cxx::free (v); +#endif value_ = 0; } } |