tcpreplay
tcpreplay copied to clipboard
improper free() causes abort in tcpreplay_close()
http://tcpreplay.synfin.net/ticket/528
patch:
Index: src/tcpreplay_api.c
===================================================================
--- src/tcpreplay_api.c (revision 2648)
+++ src/tcpreplay_api.c (working copy)
@@ -344,6 +344,7 @@
tcpreplay_opt_t *options;
interface_list_t *intlist, *intlistnext;
packet_cache_t *packet_cache, *next;
+ int i;
assert(ctx);
assert(ctx->options);
@@ -363,15 +364,14 @@
#endif
/* free the file cache */
- if (options->file_cache != NULL) {
- packet_cache = options->file_cache->packet_cache;
+ for (i = 0; i < MAX_FILES; i++) {
+ packet_cache = options->file_cache[i].packet_cache;
while (packet_cache != NULL) {
next = packet_cache->next;
safe_free(packet_cache->pktdata);
safe_free(packet_cache);
packet_cache = next;
}
- safe_free(options->file_cache);
}
/* free our interface list */