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;
}