diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-05-28 08:51:12 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-05-28 08:55:10 +0200 |
commit | 3eb7785398552e6d62e7160207be14b1ec56df24 (patch) | |
tree | 1aac428b68b6729bf4b5152cb13ff6a5e383e45a /helpcompiler | |
parent | bf2e8fadd8b861e9606ab24dcd7e253d8daedd3f (diff) |
Fix memory leak
...and add---most likely necessary---null check
Change-Id: I3f31c20442c45ddfd98429347f5c2521597c1769
Diffstat (limited to 'helpcompiler')
-rw-r--r-- | helpcompiler/source/HelpCompiler.cxx | 17 |
1 files changed, 11 insertions, 6 deletions
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) { |