|
|
|
|
|
|
==17213== Memcheck, a memory error detector ==17213== Copyright © 2002-2012, and GNU GPL'd, by Julian Seward et al. ==17213== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==17213== Command: ./Lab ==17213== Input a number to put in the tree: 10 ==17213== Conditional jump or move depends on uninitialised value(s) ==17213== at 0x400DE0: BinarySearchTree<int>::add(int) (BinarySearchTree.hpp:22) ==17213== by 0x400B8F: main (main.cpp:15) ==17213== ==17213== Use of uninitialised value of size 8 ==17213== at 0x401330: Node<int>::getValue() (Node.hpp:17) ==17213== by 0x400F49: BinarySearchTree<int>::add(int, Node<int>*) (BinarySearchTree.hpp:69) ==17213== by 0x400E30: BinarySearchTree<int>::add(int) (BinarySearchTree.hpp:29) ==17213== by 0x400B8F: main (main.cpp:15) ==17213== ==17213== Use of uninitialised value of size 8 ==17213== at 0x401342: Node<int>::getLeft() (Node.hpp:23) ==17213== by 0x400F5F: BinarySearchTree<int>::add(int, Node<int>*) (BinarySearchTree.hpp:71) ==17213== by 0x400E30: BinarySearchTree<int>::add(int) (BinarySearchTree.hpp:29) ==17213== by 0x400B8F: main (main.cpp:15) ==17213== ==17213== Use of uninitialised value of size 8 ==17213== at 0x401342: Node<int>::getLeft() (Node.hpp:23) ==17213== by 0x400FB7: BinarySearchTree<int>::add(int, Node<int>*) (BinarySearchTree.hpp:80) ==17213== by 0x400E30: BinarySearchTree<int>::add(int) (BinarySearchTree.hpp:29) ==17213== by 0x400B8F: main (main.cpp:15) ==17213== ==17213== Invalid read of size 4 ==17213== at 0x401330: Node<int>::getValue() (Node.hpp:17) ==17213== by 0x400F49: BinarySearchTree<int>::add(int, Node<int>*) (BinarySearchTree.hpp:69) ==17213== by 0x400FCB: BinarySearchTree<int>::add(int, Node<int>*) (BinarySearchTree.hpp:80) ==17213== by 0x400E30: BinarySearchTree<int>::add(int) (BinarySearchTree.hpp:29) ==17213== by 0x400B8F: main (main.cpp:15) ==17213== Address 0x64894cd8246c8958 is not stack'd, malloc'd or (recently) free'd ==17213== ==17213== ==17213== Process terminating with default action of signal 11 (SIGSEGV) ==17213== General Protection Fault ==17213== at 0x401330: Node<int>::getValue() (Node.hpp:17) ==17213== by 0x400F49: BinarySearchTree<int>::add(int, Node<int>*) (BinarySearchTree.hpp:69) ==17213== by 0x400FCB: BinarySearchTree<int>::add(int, Node<int>*) (BinarySearchTree.hpp:80) ==17213== by 0x400E30: BinarySearchTree<int>::add(int) (BinarySearchTree.hpp:29) ==17213== by 0x400B8F: main (main.cpp:15) ==17213== ==17213== HEAP SUMMARY: ==17213== in use at exit: 0 bytes in 0 blocks ==17213== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==17213== ==17213== All heap blocks were freed -- no leaks are possible ==17213== ==17213== For counts of detected and suppressed errors, rerun with: -v ==17213== Use --track-origins=yes to see where uninitialised values come from ==17213== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 2 from 2) Segmentation fault (core dumped) |
void BinarySearchTree<T>::add(T, Node<T> *&);
void BinarySearchTree<T>::add(T value, Node<T>* & subtree)
|
|
BinarySearchTree.hpp|67|error: prototype for ‘void BinarySearchTree<T>::add(T, Node<T>*&)’ does not match any in class ‘BinarySearchTree<T>’| BinarySearchTree.hpp|20|error: candidates are: void BinarySearchTree<T>::add(T)| BinarySearchTree.h|19|error:void BinarySearchTree<T>::add(T, Node<T>*)| |
|
|
void BinarySearchTree<T>::add(T, Node<T>*)
void BinarySearchTree<T>::add(T, Node<T> *&)
|
|
|
|
add(value, subtree->getLeft());
|
|
|
|