edits
[iotcloud.git] / version2 / src / C / NewKey.cc
index a302a78d40877bc6c436691520aacb4036e9ba3e..a3a1a87c8dbe81007c5711b0b1a219b83c85116d 100644 (file)
@@ -17,8 +17,10 @@ Entry *NewKey_decode(Slot *slot, ByteBuffer *bb) {
        Array<char> *key = new Array<char>(keylength);
        bb->get(key);
        int64_t machineid = bb->getLong();
-
-       return new NewKey(slot, IoTString_shallow(key), machineid);
+       IoTString *str = IoTString_shallow(key);
+       NewKey *newkey = new NewKey(slot, str, machineid);
+       delete str;
+       return newkey;
 }
 
 Entry *NewKey::getCopy(Slot *s) { return new NewKey(s, new IoTString(key), machineid); }