aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/history.h
diff options
context:
space:
mode:
authorGravatar Andreas Nordal <andreas_nordal_4@hotmail.com>2016-03-18 23:14:16 +0100
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2016-03-27 17:40:48 -0700
commit6495bd470d40b2b489e6fe350e2da08be64d4bec (patch)
tree79d8821e2016cdf863ffa247ee0a3a24886add1a /src/history.h
parent7accadc33f817a3e17c14c989a3b83f0d6737665 (diff)
Fix memory leaks at exit found in tests
This fixes all memory leaks found by compiling with clang++ -g -fsanitize=address and running the tests. Method: Ensure that memory is freed by the destructor of its respective container, either by storing objects directly instead of by pointer, or implementing the required destructor.
Diffstat (limited to 'src/history.h')
-rw-r--r--src/history.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/history.h b/src/history.h
index f99950aa..58291f22 100644
--- a/src/history.h
+++ b/src/history.h
@@ -43,7 +43,6 @@ typedef uint32_t history_identifier_t;
class history_item_t
{
friend class history_t;
- friend class history_lru_node_t;
friend class history_tests_t;
private:
@@ -115,15 +114,9 @@ private:
history_t(const history_t&);
history_t &operator=(const history_t&);
- /** Private creator */
- explicit history_t(const wcstring &pname);
-
/** Privately add an item. If pending, the item will not be returned by history searches until a call to resolve_pending. */
void add(const history_item_t &item, bool pending = false);
- /** Destructor */
- ~history_t();
-
/** Lock for thread safety */
pthread_mutex_t lock;
@@ -208,6 +201,12 @@ private:
static history_item_t decode_item(const char *base, size_t len, history_file_type_t type);
public:
+ /** Constructor */
+ explicit history_t(const wcstring &);
+
+ /** Destructor */
+ ~history_t();
+
/** Returns history with the given name, creating it if necessary */
static history_t & history_with_name(const wcstring &name);