Fix premature free

Do not free help filename before the open check as it is used in the
error message.
This commit is contained in:
Artem Savkov 2017-08-31 21:33:37 +02:00
parent 27d4c5849e
commit 5acda539f7
1 changed files with 3 additions and 2 deletions

View File

@ -37,11 +37,12 @@ static void discord_help_init()
/* Load help from our own help file. */
help_t *dh;
help_init(&dh, df);
g_free(df);
if(dh == NULL) {
log_message(LOGLVL_WARNING, "Error opening helpfile %s.", df);
log_message(LOGLVL_WARNING, "Error opening helpfile: %s.", df);
g_free(df);
return;
}
g_free(df);
/* Link the last entry of global.help with first entry of our help. */
help_t *h, *l = NULL;