Fix Svace issue : access memory after free 99/202699/1 accepted/tizen/unified/20190404.021956 submit/tizen/20190403.044801
authorJihoon Jung <jh8801.jung@samsung.com>
Wed, 3 Apr 2019 04:32:55 +0000 (13:32 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Wed, 3 Apr 2019 04:33:31 +0000 (13:33 +0900)
Change-Id: I7cd057b2b6956161a34d2033878c52e05e1267e3
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
ua-daemon/src/pm/ua-power-plugin-manager.c

index d1fd091..7b33e96 100644 (file)
@@ -112,12 +112,14 @@ static int __load_power_plugin(const char *path, const char *name, const char *s
        UAM_DBG("Loading [%s]", filename);
 
        handle = dlopen(filename, RTLD_NOW);
-       g_free(filename);
        if (handle == NULL) {
                UAM_ERR("Can't load plugin %s: %s", filename, dlerror());
+               g_free(filename);
                return UAM_ERROR_INTERNAL;
        }
 
+       g_free(filename);
+
        module = (uap_module_t *)dlsym(handle, symbol);
        if (module == NULL) {
                UAM_ERR("Can't load power plugin module: %s", dlerror());