diff --git a/conf/config_file.c b/conf/config_file.c index d4d5eb10ec..232938510b 100644 --- a/conf/config_file.c +++ b/conf/config_file.c @@ -291,12 +291,15 @@ static bool parse_line(config_file_t *conf, size_t cur_size = 8; size_t index = 0; - if (!line || !*line) - return false; - if (!key) return false; + if (!line || !*line) + { + free(key); + return false; + } + comment = strip_comment(line); /* Starting line with # and include includes config files. */ @@ -306,6 +309,7 @@ static bool parse_line(config_file_t *conf, if (strstr(comment, "include ") == comment) { add_sub_conf(conf, comment + strlen("include ")); + free(key); return false; } } diff --git a/frontend/menu/disp/lakka.c b/frontend/menu/disp/lakka.c index d2adfb59f5..75e89416a9 100644 --- a/frontend/menu/disp/lakka.c +++ b/frontend/menu/disp/lakka.c @@ -1122,6 +1122,12 @@ static void *lakka_init(void) categories = (menu_category_t*) calloc(num_categories, sizeof(menu_category_t)); + if (!categories) + { + free(menu); + return NULL; + } + lakka_init_settings(); for (i = 1; i < num_categories; i++) @@ -1137,7 +1143,10 @@ static void *lakka_init(void) info = (core_info_t*)&info_list->list[i-1]; if (info == NULL) - return NULL; + { + free(menu); + return NULL + }; strlcpy(category->name, info->display_name, sizeof(category->name)); strlcpy(category->libretro, info->path, sizeof(category->libretro));