upnpbrowser : fix memleaks

Origin commit data
------------------
Branch: ni/coolstream
Commit: 6d81594f12
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2017-10-09 (Mon, 09 Oct 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2017-10-09 16:36:49 +02:00
parent 17e4271b00
commit 50ab515db9

View File

@@ -295,15 +295,13 @@ bool CUpnpBrowserGui::getResults(std::string id, unsigned int start, unsigned in
std::vector<UPnPEntry> *CUpnpBrowserGui::decodeResult(std::string result)
{
xmlNodePtr root, node, snode;
std::vector<UPnPEntry> *entries;
xmlDocPtr parser = parseXml(result.c_str(),"UTF-8");
root = xmlDocGetRootElement(parser);
if (!root) {
xmlFreeDoc(parser);
return NULL;
}
entries = new std::vector<UPnPEntry>;
std::vector<UPnPEntry> *entries = new std::vector<UPnPEntry>;
for (node=xmlChildrenNode(root); node; node=xmlNextNode(node))
{
@@ -644,9 +642,17 @@ void CUpnpBrowserGui::playnext(void)
showPicture((*entries)[0].resources[preferred].url);
}
delete entries;
entries = NULL;
return;
}else{
delete entries;
entries = NULL;
}
} else {
if(entries){
delete entries;
entries = NULL;
}
neutrino_msg_t msg;
neutrino_msg_data_t data;
g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display
@@ -658,7 +664,10 @@ void CUpnpBrowserGui::playnext(void)
}
}
}
if(entries){
delete entries;
entries = NULL;
}
m_frameBuffer->Clear();
}
@@ -690,9 +699,13 @@ bool CUpnpBrowserGui::getItems(std::string id, unsigned int index, std::vector<U
rfound=true;
}
}
if (!entries || !nfound || !tfound || !rfound || returned != entries->size() || returned == 0)
if (!entries || !nfound || !tfound || !rfound || returned != entries->size() || returned == 0){
if(entries){
delete entries;
entries = NULL;
}
return false;
}
return true;
}
@@ -923,6 +936,7 @@ bool CUpnpBrowserGui::selectItem(std::string id)
#endif
delete entries;
entries = NULL;
timeout = 0;
return endall;