Skip to content

Commit

Permalink
Merge branch 'OnionUI:main' into common-utils-file-leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
MattCatz authored Aug 31, 2024
2 parents 42e0acd + d78c844 commit 2439e26
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 21 deletions.
1 change: 1 addition & 0 deletions src/batmon/batmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ void log_new_percentage(int new_bat_value, int is_charging)
const char *delete_sql = "DELETE FROM bat_activity WHERE id = (SELECT MIN(id) FROM bat_activity);";
sqlite3_prepare_v2(bat_log_db, delete_sql, -1, &stmt, 0);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
}
}
close_battery_log_db();
Expand Down
4 changes: 2 additions & 2 deletions src/common/system/lang.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void lang_removeIconLabels(bool remove_icon_labels, bool remove_hints)
}

json_save(root, file_path);
cJSON_free(root);
cJSON_Delete(root);
}
closedir(dp);
}
Expand Down Expand Up @@ -157,7 +157,7 @@ bool lang_load(void)
}
}

cJSON_free(lang_file);
cJSON_Delete(lang_file);

return true;
}
Expand Down
6 changes: 3 additions & 3 deletions src/common/system/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void _settings_load_keymap(void)
json_getInt(keymap, "ingame_double_press", &settings.ingame_double_press);
json_getString(keymap, "mainui_button_x", settings.mainui_button_x);
json_getString(keymap, "mainui_button_y", settings.mainui_button_y);
cJSON_free(keymap);
cJSON_Delete(keymap);
}

void _settings_load_mainui(void)
Expand Down Expand Up @@ -188,7 +188,7 @@ void _settings_load_mainui(void)
strcpy(settings.theme, DEFAULT_THEME_PATH);
}

cJSON_free(json_root);
cJSON_Delete(json_root);
}

void settings_load(void)
Expand Down Expand Up @@ -384,7 +384,7 @@ bool settings_saveSystemProperty(const char *prop_name, int value)

cJSON_SetNumberValue(prop, value);
json_save(json_root, MAIN_UI_SETTINGS);
cJSON_free(json_root);
cJSON_Delete(json_root);
temp_flag_set("settings_changed", true);

return true;
Expand Down
4 changes: 2 additions & 2 deletions src/common/theme/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ bool theme_applyConfig(Theme_s *config, const char *config_path,
json_getInt(json_frame, "border-left", &config->frame.border_left);
json_getInt(json_frame, "border-right", &config->frame.border_right);

cJSON_free(json_root);
cJSON_Delete(json_root);

return true;
}
Expand Down Expand Up @@ -244,7 +244,7 @@ static bool _theme_overrides_changed = false;
void theme_freeOverrides(void)
{
if (_theme_overrides != NULL)
cJSON_free(_theme_overrides);
cJSON_Delete(_theme_overrides);
_theme_overrides = NULL;
}

Expand Down
4 changes: 2 additions & 2 deletions src/common/utils/apply_icons.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ bool apply_singleIconByFullPath(const char *config_path, const char *icon_path)
json_forceSetString(config, "iconsel", sel_path);

_saveConfigFile(config_path, cJSON_Print(config));
cJSON_free(config);
cJSON_Delete(config);

return true;
}
Expand Down Expand Up @@ -174,7 +174,7 @@ bool _apply_singleIconFromPack(const char *config_path,
json_forceSetString(config, "icon", icon_path);

_saveConfigFile(config_path, cJSON_Print(config));
cJSON_free(config);
cJSON_Delete(config);

printf_debug("Applied icon to %s\nicon: %s\niconsel: %s\n", config_path,
icon_path, sel_path);
Expand Down
2 changes: 1 addition & 1 deletion src/common/utils/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ bool json_forceSetString(cJSON *object, const char *key, const char *value)
* @brief Loads and parses a json file.
*
* @param file_path
* @return cJSON* Root json object. Remember to cJSON_free the result.
* @return cJSON* Root json object. Remember to cJSON_Delete the result.
*/
cJSON *json_load(const char *file_path)
{
Expand Down
2 changes: 1 addition & 1 deletion src/gameSwitcher/gameSwitcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ int main(int argc, char *argv[])
#endif

if (json_root != NULL)
cJSON_free(json_root);
cJSON_Delete(json_root);

SDL_BlitSurface(screen, NULL, video, NULL);
SDL_Flip(video);
Expand Down
2 changes: 1 addition & 1 deletion src/infoPanel/infoPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static bool loadImagesPathsFromJson(const char *config_path,
strncpy((*images_titles)[i], image_title, g_title_max_length);
}

cJSON_free(json_root);
cJSON_Delete(json_root);

return true;
}
Expand Down
8 changes: 4 additions & 4 deletions src/randomGamePicker/randomGamePicker.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ bool loadEmuConfig(char *emupath, char *emuname_out, char *romsdir_out,
if (romsdir_out != NULL) {
char romsdir_rel[STR_MAX];
if (!json_getString(json_root, "rompath", romsdir_rel)) {
cJSON_free(json_root);
cJSON_Delete(json_root);
return false;
}

// Ignore Search results
if (strncmp(romsdir_rel, "../../App/", 10) == 0) {
cJSON_free(json_root);
cJSON_Delete(json_root);
return false;
}

Expand Down Expand Up @@ -95,7 +95,7 @@ bool loadEmuConfig(char *emupath, char *emuname_out, char *romsdir_out,
imgpath_rel);
}

cJSON_free(json_root);
cJSON_Delete(json_root);
return true;
}

Expand Down Expand Up @@ -287,7 +287,7 @@ bool addRandomFromJson(char *json_path)
count++;
}

cJSON_free(json_root);
cJSON_Delete(json_root);
}

total_games_count = system_count = count;
Expand Down
4 changes: 2 additions & 2 deletions src/tweaks/icons.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,14 @@ bool _add_config_icon(const char *path, const char *name,
cJSON *config = json_load(config_path);

if (!json_getString(config, "icon", icon_path)) {
cJSON_free(config);
cJSON_Delete(config);
return false;
}

if (!json_getString(config, "label", label))
strncpy(label, name, STR_MAX - 1);

cJSON_free(config);
cJSON_Delete(config);

ListItem item = {.action = action};

Expand Down
2 changes: 1 addition & 1 deletion static/build/.tmp_update/script/scraper/scrap_launchbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ set -f
# =================

if ! [ -z "$CurrentRom" ]; then
romfilter="-name \"*$CurrentRom*\""
romfilter="-name \"*$(echo "$CurrentRom" | sed -e 's_\[_\\\[_g' -e 's_\]_\\\]_g')*\""
fi


Expand Down
2 changes: 1 addition & 1 deletion static/build/.tmp_update/script/scraper/scrap_retroarch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ if ! [ -z "$CurrentRom" ]; then
# CurrentRom_noapostrophe=${CurrentRom//\'/\\\'} # replacing ' by \'
# romfilter="-name '*$CurrentRom_noapostrophe*'"
# romfilter="-name '*$CurrentRom*'"
romfilter="-name \"*$CurrentRom*\""
romfilter="-name \"*$(echo "$CurrentRom" | sed -e 's_\[_\\\[_g' -e 's_\]_\\\]_g')*\""
#romfilter="-name '*$CurrentRom*'"

fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ if ! [ -z "$CurrentRom" ]; then
# romfilter="-name '*$CurrentRom_noapostrophe*'"
# romfilter="-name '*$CurrentRom*'"
#romfilter="-name '*$CurrentRom*'"
romfilter="-name \"*$CurrentRom*\""
romfilter="-name \"*$(echo "$CurrentRom" | sed -e 's_\[_\\\[_g' -e 's_\]_\\\]_g')*\""
fi


Expand Down
3 changes: 3 additions & 0 deletions website/docs/07-apps/02-community-apps/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ Here you will find a selection of third party applications and tools compatible

9. [**WiFi Password Saver**](https://github.com/funkykovalski/WIFI) by funkykovalski
*Script to save WiFi password*

10. [**Lynx web browser**](https://github.com/tailtwo/lynx-miyoo) by snowram
*The Lynx terminal based web browser*

0 comments on commit 2439e26

Please sign in to comment.