Browse Source

Merge pull request #2750 from richardkchapman/memleak-gh-2748

gh-2748 Minor memory leak

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 13 years ago
parent
commit
7f75c67e71
1 changed files with 5 additions and 3 deletions
  1. 5 3
      system/jlib/jutil.cpp

+ 5 - 3
system/jlib/jutil.cpp

@@ -2283,11 +2283,13 @@ static IPropertyTree *getOSSdirTree()
     return NULL;
 }
 
-bool getConfigurationDirectory(const IPropertyTree *dirtree,const char *category, const char *component,const char *instance, StringBuffer &dirout)
+bool getConfigurationDirectory(const IPropertyTree *useTree, const char *category, const char *component, const char *instance, StringBuffer &dirout)
 {
+    Linked<const IPropertyTree> dirtree = useTree;
     if (!dirtree) 
-        dirtree = getOSSdirTree();
-    if (dirtree&&category&&*category) {
+        dirtree.setown(getOSSdirTree());
+    if (dirtree && category && *category)
+    {
         const char *name = dirtree->queryProp("@name");
         if (name&&*name) {
             StringBuffer q("Category[@name=\"");