diff options
author | Peter Wu <peter@lekensteyn.nl> | 2019-01-25 17:04:33 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2019-01-26 07:42:17 +0000 |
commit | 0b632861e21222513fac38487a56e442a4aac2fb (patch) | |
tree | 26b76a0bec4ab15dd7f34c0ae222ae0faf8e9853 /ringbuffer.h | |
parent | 728183c27e778ada5a329a55353b09a83d11ceac (diff) |
dumpcap: fix memory leak in ringbuffer mode
'save_file' is used both for holding the -w command-line argument as
well as the current filename that is being written. In ringbuffer mode,
the former is already freed while the latter changes after rotation. Be
sure to free all ringbuffer filenames on exit.
Fixes test failures due to ASAN reporting memory leaks for:
test_dumpcap_ringbuffer_filesize
test_dumpcap_pcapng_single_in_multi_out
test_dumpcap_pcapng_multi_in_multi_out
test_dumpcap_ringbuffer_packets
Change-Id: Ib817d8340275d7afa7e149dcfbbc59ed78293c34
Reviewed-on: https://code.wireshark.org/review/31739
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ringbuffer.h')
-rw-r--r-- | ringbuffer.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ringbuffer.h b/ringbuffer.h index b56fa056fa..4c1a3baaa9 100644 --- a/ringbuffer.h +++ b/ringbuffer.h @@ -24,6 +24,7 @@ #define RINGBUFFER_WARN_NUM_FILES 65535 int ringbuf_init(const char *capture_name, guint num_files, gboolean group_read_access); +gboolean ringbuf_is_initialized(void); const gchar *ringbuf_current_filename(void); FILE *ringbuf_init_libpcap_fdopen(int *err); gboolean ringbuf_switch_file(FILE **pdh, gchar **save_file, int *save_file_fd, @@ -35,7 +36,7 @@ void ringbuf_error_cleanup(void); #endif /* ringbuffer.h */ /* - * Editor modelines - http://www.wireshark.org/tools/modelines.html + * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local Variables: * c-basic-offset: 2 |