Further SVACE fixes 51/245351/2 accepted/tizen_7.0_unified accepted/tizen_7.0_unified_hotfix accepted/tizen_8.0_unified accepted/tizen_unified tizen tizen_7.0 tizen_7.0_hotfix tizen_8.0 accepted/tizen/7.0/unified/20221110.062342 accepted/tizen/7.0/unified/hotfix/20221116.110945 accepted/tizen/8.0/unified/20231005.095032 accepted/tizen/unified/20211108.181458 submit/tizen/20211103.072537 submit/tizen/20211104.092607 submit/tizen_base/20211104.091630 tizen_7.0_m2_release tizen_8.0_m2_release
authorMichal Bloch <m.bloch@samsung.com>
Thu, 20 Aug 2020 12:10:47 +0000 (14:10 +0200)
committerMichal Bloch <m.bloch@samsung.com>
Wed, 7 Oct 2020 12:17:57 +0000 (14:17 +0200)
Change-Id: I9a89538e95b71822eee9af8cd4eb21ae07fd45d7
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
lib/libconfig.c
lib/libconfigcpp.c++
lib/scanctx.c

index 47920ec..5a4d5a1 100644 (file)
@@ -853,6 +853,9 @@ static config_setting_t *config_setting_create(config_setting_t *parent,
     return(NULL);
 
   setting = _new(config_setting_t);
+  if (!setting)
+    return NULL;
+
   setting->parent = parent;
   setting->name = (name == NULL) ? NULL : strdup(name);
   setting->type = type;
@@ -1568,6 +1571,9 @@ config_setting_t *config_setting_get_member(const config_setting_t *setting,
   if(setting->type != CONFIG_TYPE_GROUP)
     return(NULL);
 
+  if(! name)
+    return(NULL);
+
   return(__config_list_search(setting->value.list, name, NULL));
 }
 
index cdc4ffc..c26d379 100644 (file)
@@ -1017,7 +1017,7 @@ const Setting & Setting::getParent() const
   config_setting_t *setting = config_setting_parent(_setting);
 
   if(! setting)
-    throw SettingNotFoundException(NULL);
+    throw SettingNotFoundException("Setting::getParent - parent not found");
 
   return(wrapSetting(setting));
 }
@@ -1029,7 +1029,7 @@ Setting & Setting::getParent()
   config_setting_t *setting = config_setting_parent(_setting);
 
   if(! setting)
-    throw SettingNotFoundException(NULL);
+    throw SettingNotFoundException("Setting::getParent - parent not found");
 
   return(wrapSetting(setting));
 }
index 42d584e..9cc5b02 100644 (file)
@@ -133,9 +133,9 @@ const char *scanctx_getpath(struct scan_context *ctx)
   if((name[0] != FILE_SEPARATOR[0]) && ctx->config->include_dir)
   {
     full_path = scanctx_filename(ctx, ctx->config->include_dir, name);
+    free((void*)name);
     if(!full_path)
       return NULL;
-    free((void*)name);
   }
   else
     full_path = name;