diff options
author | Gerald Combs <gerald@wireshark.org> | 2006-02-23 23:12:42 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2006-02-23 23:12:42 +0000 |
commit | 64104b17493323ad04daa91ebbca746505f92e10 (patch) | |
tree | e97d11124ac1f7acea29ad2763f84b14deedf796 /epan/emem.c | |
parent | 83f28ac9f50208ac502c347f501c7c59c8bf19dd (diff) |
Print an error when we detect memory corruption. Fix a typo in a comment.
svn path=/trunk/; revision=17395
Diffstat (limited to 'epan/emem.c')
-rw-r--r-- | epan/emem.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/epan/emem.c b/epan/emem.c index 3614b43dd3..ecd178213e 100644 --- a/epan/emem.c +++ b/epan/emem.c @@ -526,8 +526,8 @@ ep_free_all(void) while (npc != NULL) { #ifndef EP_DEBUG_FREE for (i = 0; i < npc->c_count; i++) { - /* XXX - This isn't very graceful */ - g_assert(memcmp(npc->canary[i], &ep_canary, npc->cmp_len[i]) == 0); + if (memcmp(npc->canary[i], &ep_canary, npc->cmp_len[i]) != 0) + g_error("Per-packet memory corrupted."); } npc->c_count = 0; npc->amount_free=EMEM_PACKET_CHUNK_SIZE; @@ -554,7 +554,7 @@ se_free_all(void) emem_chunk_t *npc; guint i; - /* move all used chunks ove to the free list */ + /* move all used chunks over to the free list */ while(se_packet_mem.used_list){ npc=se_packet_mem.used_list; se_packet_mem.used_list=se_packet_mem.used_list->next; @@ -567,8 +567,8 @@ se_free_all(void) while (npc != NULL) { #ifndef SE_DEBUG_FREE for (i = 0; i < npc->c_count; i++) { - /* XXX - This isn't very graceful */ - g_assert(memcmp(npc->canary[i], &se_canary, npc->cmp_len[i]) == 0); + if (memcmp(npc->canary[i], &se_canary, npc->cmp_len[i]) != 0) + g_error("Per-session memory corrupted."); } npc->c_count = 0; npc->amount_free=EMEM_PACKET_CHUNK_SIZE; |