From 3eb7785398552e6d62e7160207be14b1ec56df24 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 28 May 2014 08:51:12 +0200 Subject: Fix memory leak ...and add---most likely necessary---null check Change-Id: I3f31c20442c45ddfd98429347f5c2521597c1769 --- helpcompiler/source/HelpCompiler.cxx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'helpcompiler/source/HelpCompiler.cxx') diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx index 5795217fcd3b..8c5a579e5a92 100644 --- a/helpcompiler/source/HelpCompiler.cxx +++ b/helpcompiler/source/HelpCompiler.cxx @@ -174,13 +174,18 @@ xmlNodePtr HelpCompiler::clone(xmlNodePtr node, const std::string& appl) if (strcmp((const char*)list->name, "switchinline") == 0 || strcmp((const char*)list->name, "switch") == 0) { std::string tmp=""; - if (strcmp((const char*)xmlGetProp(list, (xmlChar*)"select"), "sys")) + xmlChar * prop = xmlGetProp(list, (xmlChar*)"select"); + if (prop != 0) { - tmp = gui; - } - if (strcmp((const char*)xmlGetProp(list, (xmlChar*)"select"), "appl")) - { - tmp = appl; + if (strcmp((char *)prop, "sys") == 0) + { + tmp = gui; + } + else if (strcmp((char *)prop, "appl") == 0) + { + tmp = appl; + } + xmlFree(prop); } if (tmp.compare("") != 0) { -- cgit