diff options
-rwxr-xr-x | parameter/Element.cpp | 8 | ||||
-rwxr-xr-x | parameter/SubsystemObject.cpp | 8 | ||||
-rw-r--r-- | parameter/SystemClass.cpp | 8 | ||||
-rw-r--r-- | xmlserializer/XmlElement.cpp | 6 |
4 files changed, 24 insertions, 6 deletions
diff --git a/parameter/Element.cpp b/parameter/Element.cpp index e5987e1..6d1d418 100755 --- a/parameter/Element.cpp +++ b/parameter/Element.cpp @@ -58,7 +58,9 @@ void CElement::log_info(const string& strMessage, ...) const va_end(listPointer); - doLog(false, pacBuffer); + if (pacBuffer != NULL) { + doLog(false, pacBuffer); + } free(pacBuffer); } @@ -74,7 +76,9 @@ void CElement::log_warning(const string& strMessage, ...) const va_end(listPointer); - doLog(true, pacBuffer); + if (pacBuffer != NULL) { + doLog(true, pacBuffer); + } free(pacBuffer); } diff --git a/parameter/SubsystemObject.cpp b/parameter/SubsystemObject.cpp index fd263c6..fb635c8 100755 --- a/parameter/SubsystemObject.cpp +++ b/parameter/SubsystemObject.cpp @@ -222,7 +222,9 @@ void CSubsystemObject::log_info(const string& strMessage, ...) const va_end(listPointer); - _pInstanceConfigurableElement->log_info(pacBuffer); + if (pacBuffer != NULL) { + _pInstanceConfigurableElement->log_info(pacBuffer); + } free(pacBuffer); } @@ -238,7 +240,9 @@ void CSubsystemObject::log_warning(const string& strMessage, ...) const va_end(listPointer); - _pInstanceConfigurableElement->log_warning(pacBuffer); + if (pacBuffer != NULL) { + _pInstanceConfigurableElement->log_warning(pacBuffer); + } free(pacBuffer); } diff --git a/parameter/SystemClass.cpp b/parameter/SystemClass.cpp index e4fab19..8ab7c94 100644 --- a/parameter/SystemClass.cpp +++ b/parameter/SystemClass.cpp @@ -219,9 +219,13 @@ bool CSystemClass::loadPlugins(list<string>& lstrPluginFiles, list<string>& lstr if (!lib_handle) { + const char *err = dlerror(); // Failed - lstrError.push_back("Plugin load failed: " + string(dlerror())); - + if (err == NULL) { + lstrError.push_back("dlerror failed"); + } else { + lstrError.push_back("Plugin load failed: " + string(err)); + } // Next plugin ++it; diff --git a/xmlserializer/XmlElement.cpp b/xmlserializer/XmlElement.cpp index d0ab91a..bda3973 100644 --- a/xmlserializer/XmlElement.cpp +++ b/xmlserializer/XmlElement.cpp @@ -86,6 +86,9 @@ string CXmlElement::getAttributeString(const string &strAttributeName) const return ""; } xmlChar* pucXmlValue = xmlGetProp((xmlNode*)_pXmlElement, (const xmlChar*)strAttributeName.c_str()); + if (pucXmlValue == NULL) { + return ""; + } string strValue((const char*)pucXmlValue); @@ -130,6 +133,9 @@ double CXmlElement::getAttributeDouble(const string &strAttributeName) const string CXmlElement::getTextContent() const { xmlChar* pucXmlContent = xmlNodeGetContent(_pXmlElement); + if (pucXmlContent == NULL) { + return ""; + } string strContent((const char*)pucXmlContent); |