edits
[iotcloud.git] / version2 / src / C / Slot.cc
index 03aa3cc1a8f12553774e16e7e7cb5965ed4447de..4a6f268d016ac2d4418b0bb100274b7449c8a0ea 100644 (file)
@@ -46,6 +46,15 @@ Slot::Slot(Table *_table, int64_t _seqnum, int64_t _machineid, int64_t _localSeq
        localSequenceNumber(_localSequenceNumber) {
 }
 
+Slot::~Slot() {
+       if (hmac != NULL)
+               delete hmac;
+       delete prevhmac;
+       for(uint i=0; i< entries->size(); i++)
+               delete entries->get(i);
+       delete entries;
+}
+
 Entry *Slot::addEntry(Entry *e) {
        e = e->getCopy(this);
        entries->add(e);
@@ -84,7 +93,8 @@ Slot *Slot_decode(Table *table, Array<char> *array, Mac *mac) {
        bb->get(prevhmac);
        if (!realmac->equals(hmac))
                throw new Error("Server Error: Invalid HMAC!  Potential Attack!");
-
+       delete realmac;
+       
        int64_t seqnum = bb->getLong();
        int64_t machineid = bb->getLong();
        int numentries = bb->getInt();