Avoid iterating over a NULL hash sandbox/lstelmach/null-hash
authorŁukasz Stelmach <l.stelmach@samsung.com>
Tue, 18 Sep 2018 14:37:46 +0000 (16:37 +0200)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Tue, 18 Sep 2018 14:37:54 +0000 (16:37 +0200)
Change-Id: I7f783bf192bb27e9d3748208d8f9a551420dc298
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
src/heart/logging.c

index bf9134ca84bb77c1428157c1a30dd82b210ffaf2..0fc03ebc63e5317ed45e033d72d4463abded5574 100644 (file)
@@ -437,6 +437,11 @@ int logging_module_init(char *name, enum logging_period max_period,
        }
 
        snprintf(buf, LOGGING_BUF_MAX, CREATE_QUERY, name);
+       if (module->db_list == NULL) {
+               _E("db_list is NULL, name(%s), db_type(%d)", name, db_type);
+               ret = RESOURCED_ERROR_FAIL;
+               goto error;
+       }
        g_hash_table_iter_init(&iter, module->db_list);
        while (g_hash_table_iter_next(&iter, &key, &value)) {
                /* create table using module name and field_forms */