diff options
author | Dhruva Krishnamurthy <dhruvakm@gmail.com> | 2016-08-30 06:45:14 -0700 |
---|---|---|
committer | Dhruva Krishnamurthy <dhruvakm@gmail.com> | 2016-08-30 06:45:14 -0700 |
commit | 7659cdd34d33498b3e172730a888f8ea793e1ef3 (patch) | |
tree | ee2b4aa4cb96ad116c93eeaa8a5b7174a208db79 | |
parent | a90055612f3b606a66211706821b4f42d1bc85b7 (diff) | |
download | hardware_libhardware-7659cdd34d33498b3e172730a888f8ea793e1ef3.zip hardware_libhardware-7659cdd34d33498b3e172730a888f8ea793e1ef3.tar.gz hardware_libhardware-7659cdd34d33498b3e172730a888f8ea793e1ef3.tar.bz2 |
Memory leak fix during sensor HAL initialization
Change-Id: If8833dd1285f33498277c10b0e1fd0a1269284a0
-rw-r--r-- | modules/sensors/multihal.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/sensors/multihal.cpp b/modules/sensors/multihal.cpp index 8330ff3..48f2be3 100644 --- a/modules/sensors/multihal.cpp +++ b/modules/sensors/multihal.cpp @@ -490,14 +490,14 @@ static void lazy_init_modules() { pthread_mutex_unlock(&init_modules_mutex); return; } - std::vector<std::string> *so_paths = new std::vector<std::string>(); - get_so_paths(so_paths); + std::vector<std::string> so_paths; + get_so_paths(&so_paths); // dlopen the module files and cache their module symbols in sub_hw_modules sub_hw_modules = new std::vector<hw_module_t *>(); dlerror(); // clear any old errors const char* sym = HAL_MODULE_INFO_SYM_AS_STR; - for (std::vector<std::string>::iterator it = so_paths->begin(); it != so_paths->end(); it++) { + for (std::vector<std::string>::iterator it = so_paths.begin(); it != so_paths.end(); it++) { const char* path = it->c_str(); void* lib_handle = dlopen(path, RTLD_LAZY); if (lib_handle == NULL) { |