Merge "Free version buffer in the Vendor HAL's XML parsing logic." into udc-dev
diff --git a/wifi/aidl/default/wifi_legacy_hal_factory.cpp b/wifi/aidl/default/wifi_legacy_hal_factory.cpp
index 60f81ed..0359d6f 100644
--- a/wifi/aidl/default/wifi_legacy_hal_factory.cpp
+++ b/wifi/aidl/default/wifi_legacy_hal_factory.cpp
@@ -128,7 +128,7 @@
 void WifiLegacyHalFactory::initVendorHalsDescriptorList() {
     xmlDocPtr xml;
     xmlNodePtr node, cnode;
-    char* version;
+    char* version = NULL;
     std::string path;
     xmlChar* value;
     wifi_hal_lib_desc desc;
@@ -200,6 +200,10 @@
         }
     skip:
         xmlFreeDoc(xml);
+        if (version) {
+            xmlFree(version);
+            version = NULL;
+        }
     }
     ::closedir(dirPtr);
 }