Source: upstream ... > revision 1.291 > date: 2007-10-26 00:44:56 +0000; author: guy; state: Exp; lines: +13 -1 > Re-initialize the table of used registers, and the current register, > before compiling an expression; pcap_compile() can be called more than > once, and some registers can now be allocated and not freed in the > process of code generation (for example, the register allocated to hold > the length of a radiotap header, which can't be freed until we're > finished generating all the code). Index: gencode.c =================================================================== RCS file: /tcpdump/master/libpcap/gencode.c,v retrieving revision 1.290 retrieving revision 1.291 diff -c -r1.290 -r1.291 *** gencode.c 5 Oct 2007 01:40:14 -0000 1.290 --- gencode.c 26 Oct 2007 00:44:56 -0000 1.291 *************** *** 134,139 **** --- 134,140 ---- static void init_linktype(pcap_t *); + static void init_regs(void); static int alloc_reg(void); static void free_reg(int); *************** *** 369,374 **** --- 370,376 ---- n_errors = 0; root = NULL; bpf_pcap = p; + init_regs(); if (setjmp(top_ctx)) { lex_cleanup(); freechunks(); *************** *** 6045,6050 **** --- 6047,6062 ---- static int curreg; /* + * Initialize the table of used registers and the current register. + */ + static void + init_regs() + { + curreg = 0; + memset(regused, 0, sizeof regused); + } + + /* * Return the next free register. */ static int