Fixing preliminary free of readline/history which resolves #306 and resolves #305.

This commit is contained in:
Martin Dvorak 2018-08-21 07:21:06 +02:00
parent c0ee839bd7
commit 981d425ec3
2 changed files with 8 additions and 5 deletions

View file

@ -25,7 +25,7 @@ fi
# test history file - comment ALL HISTFILE exports below for test w/ production
#export HISTFILE=`pwd`/test/resources/.bash_history_valgrind_empty
#export HISTFILE=`pwd`/test/resources/.bash_history_valgrind_1_entry
export HISTFILE=`pwd`/test/resources/.bash_history_valgrind_1_entry
# Valgrind
valgrind --track-origins=yes --tool=memcheck --leak-check=full --show-leak-kinds=all ./hstr -n hist

View file

@ -221,14 +221,12 @@ HistoryItems* prioritized_history_create(int optionBigKeys, HashSet *blacklist)
radixsort_destroy(&rs);
// readline cleanup
// history/readline cleanup, clear_history() called on exit as entries are used by raw view
free(historyState);
clear_history();
return prioritizedHistory;
} else {
// readline cleanup
// history/readline cleanup, clear_history() called on exit as entries are used by raw view
free(historyState);
clear_history();
return NULL;
}
@ -249,7 +247,12 @@ void prioritized_history_destroy(HistoryItems* h)
if(h->rawItems) {
free(h->rawItems);
}
free(h);
// readline/history cleanup
free(history_get_history_state());
clear_history();
}
void history_mgmt_open(void)