diff options
author | Evan Huus <eapache@gmail.com> | 2013-10-08 15:05:45 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2013-10-08 15:05:45 +0000 |
commit | 54c558fdfc63ed9267d1a9557a6bc9ff93d7defa (patch) | |
tree | 9d0b700b0d82aa66513b0275565997fa28106b0e /epan | |
parent | 8a9e9de7bf7566f7b09bdaf0ea1310eef4193861 (diff) | |
download | wireshark-54c558fdfc63ed9267d1a9557a6bc9ff93d7defa.tar.gz |
Reorganize handling of incomplete fragments slightly. The logic hasn't changed
much, but I think this way's a little clearer, and it made it much easier to
figure out where the memory leak was.
Fixes the leaks from https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9243
svn path=/trunk/; revision=52448
Diffstat (limited to 'epan')
-rw-r--r-- | epan/reassemble.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/epan/reassemble.c b/epan/reassemble.c index f9e5289a88..5b5426b4c1 100644 --- a/epan/reassemble.c +++ b/epan/reassemble.c @@ -1887,16 +1887,22 @@ fragment_add_seq_common(reassembly_table *table, tvbuff_t *tvb, */ if ((flags & REASSEMBLE_FLAGS_CHECK_DATA_PRESENT) && !tvb_bytes_exist(tvb, offset, frag_data_len)) { - if (!more_frags) { - /* - * Remove this from the table of in-progress - * reassemblies, and free up any memory used for - * it in that table. - */ - fragment_unhash(table, *orig_keyp); - } fd_head -> flags |= FD_DATA_NOT_PRESENT; - return frag_number == 0 ? fd_head : NULL; + if (frag_number == 0) { + return fd_head; + } + else { + if (!more_frags) { + /* + * Remove this from the table of in-progress + * reassemblies, and free up any memory used for + * it in that table. + */ + fragment_unhash(table, *orig_keyp); + free_all_fragments(NULL, fd_head, NULL); + } + return NULL; + } } if (fragment_add_seq_work(fd_head, tvb, offset, pinfo, |