]> The Tcpdump Group git mirrors - tcpdump/blobdiff - tcpdump.c
tcpdump: plug a memory leak.
[tcpdump] / tcpdump.c
index 837f14e9e52d36fd36730f5dbcc76c7dd2b4d1ce..df4bc7a7f3959173816636c3346000eb0a3f7a64 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -2654,6 +2654,8 @@ DIAG_ON_ASSIGN_ENUM
                                         */
                                        dlt = new_dlt;
                                        ndo->ndo_if_printer = get_if_printer(dlt);
+                                       /* Free the old filter */
+                                       pcap_freecode(&fcode);
                                        if (pcap_compile(pd, &fcode, cmdbuf, Oflag, netmask) < 0)
                                                error("%s", pcap_geterr(pd));
                                }