Refactor content_history_free_entry

This commit is contained in:
twinaphex 2014-07-25 23:33:49 +02:00
parent 7ce4f68bcc
commit 0c39c2ef3f
2 changed files with 11 additions and 6 deletions

View File

@ -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));

View File

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