Fixed deallocation bug

This commit is contained in:
Stefan Kremser
2019-06-17 16:23:05 +02:00
parent 2f4836b3c8
commit 1cb821d659

View File

@@ -366,15 +366,16 @@ bool Attack::sendBeacon(uint8_t* mac, const char* ssid, uint8_t ch, bool wpa2) {
tmpPacket[37] = ssidLen; // update SSID length byte
memcpy(&tmpPacket[38 + ssidLen], &beaconPacket[70], wpa2 ? 39 : 13); // copy second half of packet into buffer
if (sendPacket(tmpPacket, tmpPacketSize, ch, 1)) {
bool success = sendPacket(tmpPacket, tmpPacketSize, ch, 1);
if (success) {
beacon.time = currentTime;
beacon.packetCounter++;
delete tmpPacket; // free memory of allocated buffer
return true;
} else {
delete tmpPacket; // free memory of allocated buffer
return false;
}
delete[] tmpPacket; // free memory of allocated buffer
return success;
// =====
}