mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 13:37:42 +02:00
Fixed a memory leak in TinyXML implementation (Thanks to Oliver Endriss).
This commit is contained in:
parent
39249ca2d5
commit
7019b719a5
2
HISTORY
2
HISTORY
@ -124,3 +124,5 @@ VDR Plugin 'satip' Revision History
|
||||
2015-XX-XX: Version 2.2.1
|
||||
|
||||
- Robustify the server discovery.
|
||||
- Fixed a memory leak in TinyXML implementation
|
||||
(Thanks to Oliver Endriss).
|
||||
|
@ -56,11 +56,12 @@ size_t cSatipDiscover::WriteCallback(char *ptrP, size_t sizeP, size_t nmembP, vo
|
||||
if (obj) {
|
||||
CURLcode res = CURLE_OK;
|
||||
const char *desc = NULL, *model = NULL, *addr = NULL;
|
||||
SATIP_CURL_EASY_GETINFO(obj->handleM, CURLINFO_PRIMARY_IP, &addr);
|
||||
#ifdef USE_TINYXML
|
||||
TiXmlDocument doc;
|
||||
char *xml = MALLOC(char, len + 1);
|
||||
memcpy(xml, ptrP, len);
|
||||
*(xml + len + 1) = 0;
|
||||
*(xml + len) = 0;
|
||||
doc.Parse((const char *)xml);
|
||||
TiXmlHandle docHandle(&doc);
|
||||
TiXmlElement *descElement = docHandle.FirstChild("root").FirstChild("device").FirstChild("friendlyName").ToElement();
|
||||
@ -69,6 +70,8 @@ size_t cSatipDiscover::WriteCallback(char *ptrP, size_t sizeP, size_t nmembP, vo
|
||||
TiXmlElement *modelElement = docHandle.FirstChild("root").FirstChild("device").FirstChild("satip:X_SATIPCAP").ToElement();
|
||||
if (modelElement)
|
||||
model = modelElement->GetText() ? modelElement->GetText() : "DVBS2-1";
|
||||
obj->AddServer(addr, model, desc);
|
||||
FREE_POINTER(xml);
|
||||
#else
|
||||
pugi::xml_document doc;
|
||||
pugi::xml_parse_result result = doc.load_buffer(ptrP, len);
|
||||
@ -80,9 +83,8 @@ size_t cSatipDiscover::WriteCallback(char *ptrP, size_t sizeP, size_t nmembP, vo
|
||||
if (modelNode)
|
||||
model = modelNode.text().as_string("DVBS2-1");
|
||||
}
|
||||
#endif
|
||||
SATIP_CURL_EASY_GETINFO(obj->handleM, CURLINFO_PRIMARY_IP, &addr);
|
||||
obj->AddServer(addr, model, desc);
|
||||
#endif
|
||||
}
|
||||
|
||||
return len;
|
||||
|
Loading…
x
Reference in New Issue
Block a user