const std::string SUMMARY_PERIOD_NAMES_ARRAY[]         = {"yearly", "monthly", "daily", "minutely", "secondly"};
 const std::string CALCULATION_TYPE_NAMES_ARRAY[]       = {"sum", "delta", "min", "max", "mean"};
 
-#define DEVICE_CONFIG__FILE_NAME               "dev_cfg.txt"
+#define DEVICE_CONFIG__FILE_NAME               "device_cfg"
 #define DEVICE_CONFIG__SECTION_TYPE            "device"
 #define DEVICE_CONFIG__SECTION_NAME            "base_data"
 #define DEVICE_CONFIG_VALUE_KEY__TYPE          "type"
 
                len             = len + strlen(section_name);
                len             = len + 1;
                cmd_data        = malloc(len);
-               snprintf(cmd_data, len, "%s.%s=%s", conf_file_name, section_name, section_type);
-               if (uci_lookup_ptr(ctx, &ptr, cmd_data, true) == UCI_OK) {
-                       ret_val = uci_set(ctx, &ptr);
-                       if (ret_val == UCI_OK) {
-                               //ret_val       = uci_save(ctx, ptr.p);
+               if (cmd_data != NULL) {
+                       snprintf(cmd_data, len, "%s.%s=%s", conf_file_name, section_name, section_type);
+                       if (uci_lookup_ptr(ctx, &ptr, cmd_data, true) == UCI_OK) {
+                               ret_val = uci_set(ctx, &ptr);
+                               if (ret_val == UCI_OK) {
+                                       //ret_val       = uci_save(ctx, ptr.p);
+                               }
                        }
+                       free(cmd_data);
                }
        }
        return ret_val;
                                                        ptr.option      = key;
 
                                                        if (uci_lookup_ptr(ctx, &ptr, NULL, false) == UCI_OK) {
-                                                               ptr.value       = strdup(value);
+                                                               ptr.value       = value;
                                                                uci_set(ctx, &ptr);
                                                                save    = true;
                                                        }
 
                len             = len + strlen(section_name);
                len             = len + 1;
                cmd_data        = malloc(len);
-               snprintf(cmd_data, len, "%s.%s=%s", conf_file_name, section_name, section_type);
-               if (uci_lookup_ptr(ctx, &ptr, cmd_data, true) == UCI_OK) {
-                       ret_val = uci_set(ctx, &ptr);
-                       if (ret_val == UCI_OK) {
-                               //ret_val       = uci_save(ctx, ptr.p);
+               if (cmd_data != NULL) {
+                       snprintf(cmd_data, len, "%s.%s=%s", conf_file_name, section_name, section_type);
+                       if (uci_lookup_ptr(ctx, &ptr, cmd_data, true) == UCI_OK) {
+                               ret_val = uci_set(ctx, &ptr);
+                               if (ret_val == UCI_OK) {
+                               }
                        }
+                       free(cmd_data);
                }
        }
        return ret_val;
                                                        ptr.option      = key;
 
                                                        if (uci_lookup_ptr(ctx, &ptr, NULL, false) == UCI_OK) {
-                                                               ptr.value       = strdup(value);
+                                                               ptr.value       = value;
                                                                uci_set(ctx, &ptr);
                                                                save    = true;
                                                        }