Replace rfb::strDup by safe_strdup and remove rfb::strFree in favor of free()
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3889 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/rfb/Configuration.cxx b/common/rfb/Configuration.cxx
index 9ebc20a..fd4c23a 100644
--- a/common/rfb/Configuration.cxx
+++ b/common/rfb/Configuration.cxx
@@ -67,7 +67,7 @@
// -=- Configuration implementation
Configuration::Configuration(const char* name_, Configuration* attachToGroup)
-: name(strDup(name_)), head(0), _next(0) {
+: name(safe_strdup(name_)), head(0), _next(0) {
if (attachToGroup) {
_next = attachToGroup->_next;
attachToGroup->_next = this;
@@ -182,7 +182,7 @@
if (column + (int)strlen(def_str) + 11 > width)
fprintf(stderr,"\n%*s",nameWidth+4,"");
fprintf(stderr," (default=%s)\n",def_str);
- strFree(def_str);
+ free(def_str);
} else {
fprintf(stderr,"\n");
}
@@ -315,11 +315,11 @@
char*
BoolParameter::getDefaultStr() const {
- return strDup(def_value ? "1" : "0");
+ return safe_strdup(def_value ? "1" : "0");
}
char* BoolParameter::getValueStr() const {
- return strDup(value ? "1" : "0");
+ return safe_strdup(value ? "1" : "0");
}
bool BoolParameter::isBool() const {
@@ -381,7 +381,7 @@
StringParameter::StringParameter(const char* name_, const char* desc_,
const char* v, Configuration* conf)
- : VoidParameter(name_, desc_, conf), value(strDup(v)), def_value(v)
+ : VoidParameter(name_, desc_, conf), value(safe_strdup(v)), def_value(v)
{
if (!v) {
fprintf(stderr,"Default value <null> for %s not allowed\n",name_);
@@ -390,7 +390,7 @@
}
StringParameter::~StringParameter() {
- strFree(value);
+ free(value);
}
bool StringParameter::setParam(const char* v) {
@@ -400,17 +400,17 @@
throw rfb::Exception("setParam(<null>) not allowed");
vlog.debug("set %s(String) to %s", getName(), v);
CharArray oldValue(value);
- value = strDup(v);
+ value = safe_strdup(v);
return value != 0;
}
char* StringParameter::getDefaultStr() const {
- return strDup(def_value);
+ return safe_strdup(def_value);
}
char* StringParameter::getValueStr() const {
LOCK_CONFIG;
- return strDup(value);
+ return safe_strdup(value);
}
// -=- BinaryParameter