Fix some memory leaks
[satune.git] / src / Collections / hashset.h
index 13edbf95895e589d88fb4d548e575e7cf677408c..86cbce90530034c52b19364a68426b1588dc521a 100644 (file)
@@ -117,6 +117,17 @@ public:
                table->reset();
        }
 
+       void resetAndDelete() {
+               Linknode<_Key> *tmp = list;
+               while (tmp != NULL) {
+                       Linknode<_Key> *tmpnext = tmp->next;
+                       ourfree(tmp);
+                       tmp = tmpnext;
+               }
+               list = tail = NULL;
+               table->resetAndDeleteKeys();
+       }
+
        /** @brief Adds a new key to the hashset.  Returns false if the key
         *  is already present. */