dumpcap: Reallocate the IO buffer when switching the ring buffer files

Fixes ASAN test failures for 4 suite_capture tests.

Fixes: v3.1.0rc0-261-ga55111610a ("Dumpcap: Set a bigger IO buffer(64KiB).")
Change-Id: If7b9450915af0ea751240acbde2371afa806f701
Reviewed-on: https://code.wireshark.org/review/32398
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Vasil Velichkov 2019-03-12 01:12:14 +02:00 committed by Anders Broman
parent 7c943d35a2
commit 82b0312887
1 changed files with 3 additions and 2 deletions

View File

@ -133,6 +133,7 @@ ringbuf_init(const char *capfile_name, guint num_files, gboolean group_read_acce
rb_data.unlimited = FALSE;
rb_data.fd = -1;
rb_data.pdh = NULL;
rb_data.io_buffer = NULL;
rb_data.group_read_access = group_read_access;
/* just to be sure ... */
@ -241,8 +242,8 @@ ringbuf_init_libpcap_fdopen(int *err)
}
}
#endif
/* Increase the size of the IO bubffer */
rb_data.io_buffer = (char *)g_malloc(buffsize);
/* Increase the size of the IO buffer */
rb_data.io_buffer = (char *)g_realloc(rb_data.io_buffer, buffsize);
setvbuf(rb_data.pdh, rb_data.io_buffer, _IOFBF, buffsize);
}