- ARP and ICMP double free bug fixed
- Memory leak caused by packet drop fixed - MemoryPool warns about possible double free
This commit is contained in:
parent
11d7431d96
commit
40d6417ae4
@ -62,6 +62,7 @@ void ethinf_receive(EthInterface *intf, const RawPckt *rawPckt) {
|
||||
if (pushOK) {
|
||||
ETHLIB_OS_SEM_POST(&intf->rxSem);
|
||||
} else {
|
||||
dynmem_free(rawPckt->payload);
|
||||
ERROR("Input queue full, packet dropped!\n");
|
||||
}
|
||||
}
|
||||
|
@ -153,6 +153,10 @@ void mp_free(MP *mp, const uint8_t *p) {
|
||||
if (success) {
|
||||
mp_join_free_blocks(mp);
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
WARNING("Possible double free!\n");
|
||||
}
|
||||
}
|
||||
|
||||
void mp_report(MP *mp) {
|
||||
|
@ -50,7 +50,7 @@ RawPckt mq_top(MsgQueue * mq) {
|
||||
}
|
||||
|
||||
void mq_pop(MsgQueue * mq) {
|
||||
if (mq_avail(mq) > 0) { // if there's something to pop
|
||||
if (mq_avail(mq) > 0) { // if there's anything to pop
|
||||
mq->readIdx = MQ_NEXT(mq->size, mq->readIdx);
|
||||
}
|
||||
}
|
||||
|
@ -90,6 +90,8 @@ void packsieve_input(PcktSieve *sieve, const RawPckt *rawPckt) {
|
||||
lastHeader = header;
|
||||
} while ((ownClass != 0) && lastHeader->props.validityOK);
|
||||
|
||||
lastHeader->next = NULL;
|
||||
|
||||
// ------------------------------------
|
||||
|
||||
if (!lastHeader->props.validityOK) { // if packet is not valid, then drop
|
||||
|
@ -77,7 +77,7 @@ void arp_send(const ConnBlock * connBlock, const ArpProps * props) {
|
||||
ethinf_transmit(connBlock->sieve->intf, &rpckt);
|
||||
|
||||
// release transmit buffer
|
||||
dynmem_free(txBuf);
|
||||
//dynmem_free(txBuf);
|
||||
}
|
||||
|
||||
void arp_print_report(const ConnBlock *connBlock) {
|
||||
|
@ -48,7 +48,7 @@ static int icmp_recv_cb(const Pckt * pckt, PcktSieveLayerTag tag) {
|
||||
pckt_assemble(&raw, pckt);
|
||||
|
||||
// release headers
|
||||
pckthdr_chain_free(pckt->header);
|
||||
//pckthdr_chain_free(pckt->header);
|
||||
|
||||
ethinf_transmit(intf, &raw);
|
||||
}
|
||||
|
@ -253,8 +253,6 @@ void dhcp_request(ip4_addr reqAddr, ip4_addr dhcpServerAddr) {
|
||||
}
|
||||
|
||||
static void dhcp_process(DhcpProps *props, DhcpOption *opts) {
|
||||
MSG("ENTER\n");
|
||||
|
||||
ETHLIB_OS_MTX_LOCK(&s.procMtx); // LOCK!
|
||||
|
||||
switch (s.state) {
|
||||
@ -323,8 +321,6 @@ static void dhcp_process(DhcpProps *props, DhcpOption *opts) {
|
||||
}
|
||||
|
||||
ETHLIB_OS_MTX_UNLOCK(&s.procMtx); // RELEASE!
|
||||
|
||||
MSG("EXIT\n");
|
||||
}
|
||||
|
||||
static int dhcp_resp_cb(const Pckt *pckt, PcktSieveLayerTag tag) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user