Fix memleaks and a typo
[scilab.git] / scilab / modules / preferences / src / c / getScilabPreference.c
index 0c0e206..20cc955 100644 (file)
@@ -216,10 +216,11 @@ void getDocAndCtxt(xmlDocPtr * doc, xmlXPathContextPtr * xpathCtxt)
             FREE(shortfilename_xml_conf);
             shortfilename_xml_conf = NULL;
         }
-        FREE(path);
-        path = NULL;
     }
 
+    FREE(path);
+    path = NULL;
+
     if (*doc == NULL)
     {
         *xpathCtxt = NULL;
@@ -402,9 +403,10 @@ void setPrefAttributesValues(const char * xpath, const char ** kv, const unsigne
             FREE(shortfilename_xml_conf);
             shortfilename_xml_conf = NULL;
         }
-        FREE(path);
-        path = NULL;
     }
 
+    FREE(path);
+    path = NULL;
+
     xmlFreeDoc(doc);
 }