summaryrefslogtreecommitdiff
path: root/trafgen_parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'trafgen_parser.y')
-rw-r--r--trafgen_parser.y16
1 files changed, 13 insertions, 3 deletions
diff --git a/trafgen_parser.y b/trafgen_parser.y
index a286e6b..035d9c1 100644
--- a/trafgen_parser.y
+++ b/trafgen_parser.y
@@ -1004,11 +1004,21 @@ static void dump_conf(void)
void cleanup_packets(void)
{
- size_t i;
+ size_t i, j;
for (i = 0; i < plen; ++i) {
- if (packets[i].len > 0)
- xfree(packets[i].payload);
+ struct packet *pkt = &packets[i];
+
+ if (pkt->len > 0)
+ xfree(pkt->payload);
+
+ for (j = 0; j < pkt->headers_count; j++) {
+ struct proto_hdr *hdr = pkt->headers[j];
+
+ if (hdr->fields)
+ xfree(hdr->fields);
+ xfree(hdr);
+ }
}
free(packets);