* Constructor for actual use. Takes in the url and password.
*/
CloudComm::CloudComm(Table *_table, IoTString *_baseurl, IoTString *_password, int _listeningPort) :
- baseurl(_baseurl),
+ baseurl(new IoTString(_baseurl)),
key(NULL),
mac(NULL),
password(new IoTString(_password)),
delete random;
if (baseurl)
delete baseurl;
+ if (mac)
+ delete mac;
+ if (key)
+ delete key;
}
/**
if (maxentries != 0)
sprintf(&buffer[offset], "&max=%" PRId64, maxentries);
IoTString *urlstr = new IoTString(buffer);
+ free(buffer);
return urlstr;
}
/* send the request */
int total = strlen(message);
loopWrite(sockfd, message, total);
+ free(message);
return (WebConnection) {sockfd, -1};
}
timer->startTime();
wc = openURL(urlstr);
+ delete urlstr;
writeURLDataAndClose(&wc, saltTmp);
int responsecode = getResponseCode(&wc);
int64_t sequencenumber = slot->getSequenceNumber();
Array<char> *slotBytes = slot->encode(mac);
- Array<char> *chars = encryptSlotAndPrependIV(slotBytes, slot->getSlotCryptIV());
+ Array<char> * ivBytes = slot->getSlotCryptIV();
+ Array<char> *chars = encryptSlotAndPrependIV(slotBytes, ivBytes);
+ delete ivBytes;
delete slotBytes;
IoTString *url = buildRequest(true, sequencenumber, max);
timer->startTime();
wc = openURL(url);
+ delete url;
writeURLDataAndClose(&wc, chars);
delete chars;
timer->endTime();
IoTString *url = buildRequest(false, sequencenumber, 0);
timer->startTime();
wc = openURL(url);
+ delete url;
closeURLReq(&wc);
timer->endTime();
} catch (SocketTimeoutException *e) {