1
0
mirror of https://github.com/anope/anope.git synced 2026-07-02 13:13:13 +02:00

Modified the Set() function in the character array version of ValueContainer to delete the old memory if the value is being reused, and to not allocate memory if there is no string to store.

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1464 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
Naram Qashat cyberbotx@cyberbotx.com
2008-10-23 02:24:34 +00:00
parent c77dbdc997
commit 729ae0b417
+5
View File
@@ -140,6 +140,11 @@ template<> class ValueContainer<char **> : public ValueContainerBase
/** Change value to type T of size s */
void Set(const char *newval, size_t s)
{
if (*val) delete [] *val;
if (!*newval) {
*val = NULL;
return;
}
*val = new char[s];
strlcpy(*val, newval, s);
}