From 8644e8e26bd3d818dcf0283125f7ede67ecfa690 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Jun 2016 22:28:55 +0200 Subject: [PATCH] (menu/cbs/menu_cbs_ok.c) Try to fix memory leak --- menu/cbs/menu_cbs_ok.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 04b34c0944..7c0fefa395 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -633,6 +633,7 @@ static int action_ok_playlist_entry_collection(const char *path, menu_content_ctx_playlist_info_t playlist_info; size_t selection_ptr = 0; playlist_t *playlist = NULL; + bool playlist_initialized = false; bool is_history = true; const char *entry_path = NULL; const char *entry_label = NULL; @@ -655,6 +656,7 @@ static int action_ok_playlist_entry_collection(const char *path, if (!tmp_playlist) return menu_cbs_exit(); + playlist_initialized = true; } playlist = tmp_playlist; @@ -692,8 +694,13 @@ static int action_ok_playlist_entry_collection(const char *path, found_associated_core = false; if (!found_associated_core) - return action_ok_file_load_with_detect_core(entry_path, + { + int ret = action_ok_file_load_with_detect_core(entry_path, label, type, selection_ptr, entry_idx); + if (playlist_initialized) + playlist_free(tmp_playlist); + return ret; + } menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &tmp_playlist);