Signed-off-by: Vitezslav Samel <vitezslav(a)samel.cz>
---
src/packet.c | 4 ++++
src/packet.h | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/packet.c b/src/packet.c
index 047ca68..331da82 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;
@@ -350,5 +351,8 @@ void packet_destroy(struct pkt_hdr *pkt)
free(pkt->from);
pkt->from = NULL;
+ 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)
--
1.9.1