diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-10-17 13:29:19 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-10-17 13:29:19 -0700 |
commit | 947f2be1e0345bbd6f66f6c945ad51eb7f074e8a (patch) | |
tree | cad0d2e5ee7bbf1a8df95db2defd21e8e0134028 /gencode.h | |
parent | bcbef226ca11662342b5e267e7f12066bcfd60d0 (diff) |
Plug some memory leaks.
The optimizer and code emitter (icode_to_fcode()) allocate their own
memory that must be cleaned up if an error is thrown, so we can't use
bpf_error(), we need to add our own error routines for them.
In some cases, just free up the memory before calling bpf_error().
Credit to OSS-Fuzz for finding this issue.
Diffstat (limited to 'gencode.h')
-rw-r--r-- | gencode.h | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -384,8 +384,11 @@ struct icode { int cur_mark; }; -void bpf_optimize(compiler_state_t *, struct icode *ic); +void bpf_optimize(compiler_state_t *, struct icode *); void PCAP_NORETURN bpf_parser_error(compiler_state_t *, const char *); +void bpf_vset_error(compiler_state_t *, const char *, va_list) + PCAP_PRINTFLIKE(2, 0); +void PCAP_NORETURN bpf_abort_compilation(compiler_state_t *); void PCAP_NORETURN bpf_error(compiler_state_t *, const char *, ...) PCAP_PRINTFLIKE(2, 3); |