diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index 34c77a88d3..73e1c803c9 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -242,9 +242,7 @@ void *menu_init(const void *data) if (!menu_ctx) return NULL; - menu = (menu_handle_t*)menu_ctx->init(); - - if (!menu) + if (!(menu = (menu_handle_t*)menu_ctx->init())) return NULL; strlcpy(g_settings.menu.driver, menu_ctx->ident, sizeof(g_settings.menu.driver)); diff --git a/history.c b/history.c index 57b2fc4b63..1c8651f200 100644 --- a/history.c +++ b/history.c @@ -57,9 +57,16 @@ void content_history_get_index(content_history_t *hist, static void content_history_free_entry(struct content_history_entry *entry) { - free(entry->path); - free(entry->core_path); - free(entry->core_name); + if (entry->path) + free(entry->path); + entry->path = NULL; + if (entry->core_path) + free(entry->core_path); + entry->core_path = NULL; + if (entry->core_name) + free(entry->core_name); + entry->core_name = NULL; + memset(entry, 0, sizeof(*entry)); }