Vitezslav Samel <vitezslav(a)samel.cz> writes:
Signed-off-by: Vitezslav Samel <vitezslav(a)samel.cz>
---
src/packet.c | 5 +++++
src/packet.h | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/packet.c b/src/packet.c
index 3e6a6d2..f3cc522 100644
--- a/src/packet.c
+++ b/src/packet.c
@@ -319,6 +319,7 @@ again:
int packet_init(struct pkt_hdr *pkt)
{
+ pkt->pkt_buf = xmallocz(MAX_PACKET_SIZE);
pkt->pkt_bufsize = MAX_PACKET_SIZE;
pkt->pkt_payload = NULL;
pkt->ethhdr = NULL;
@@ -352,5 +353,9 @@ void packet_destroy(struct pkt_hdr *pkt)
free(pkt->from);
pkt->from = NULL;
+ if (pkt->pkt_buf)
+ free(pkt->pkt_buf);
+ pkt->pkt_buf = NULL;
+
destroyfraglist();
}
diff --git a/src/packet.h b/src/packet.h
index 05afa68..8027760 100644
--- a/src/packet.h
+++ b/src/packet.h
@@ -21,6 +21,7 @@ packet.h - external declarations for packet.c
#define MORE_FRAGMENTS 4
struct pkt_hdr {
+ char *pkt_buf;
size_t pkt_bufsize;
char *pkt_payload;
size_t pkt_caplen; /* bytes captured */
@@ -35,7 +36,6 @@ struct pkt_hdr {
struct fddihdr *fddihdr;
struct iphdr *iphdr;
struct ip6_hdr *ip6_hdr;
- char pkt_buf[MAX_PACKET_SIZE];
};
static inline __u8 pkt_iph_len(const struct pkt_hdr *pkt)
I don't see a reason for that. Is there any?
--
Nikola