If the -V flag is used, and not all files in the -V file have the same
link-layer type, when the filter is recompiled for a new link-layer
type, the old filter program is leaked. Free the old filter before
compiling the new filter.
*/
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));
}