aboutsummaryrefslogtreecommitdiff
path: root/gencode.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-10-17 13:29:19 -0700
committerGuy Harris <guy@alum.mit.edu>2018-10-17 13:29:19 -0700
commit947f2be1e0345bbd6f66f6c945ad51eb7f074e8a (patch)
treecad0d2e5ee7bbf1a8df95db2defd21e8e0134028 /gencode.h
parentbcbef226ca11662342b5e267e7f12066bcfd60d0 (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.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/gencode.h b/gencode.h
index e97e90fe..a8199002 100644
--- a/gencode.h
+++ b/gencode.h
@@ -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);