aboutsummaryrefslogtreecommitdiffstats
path: root/epan/emem.c
diff options
context:
space:
mode:
authorkrj <krj@f5534014-38df-0310-8fa8-9805f1628bb7>2009-10-11 06:34:02 +0000
committerkrj <krj@f5534014-38df-0310-8fa8-9805f1628bb7>2009-10-11 06:34:02 +0000
commitb88399701e4351d16b3d3e3bac4a0da1e8ab7f7d (patch)
tree492b9777bf9b674c2b0887ac8628df7729afb257 /epan/emem.c
parentc04dda6b082e8b695a181e15bd353f8269a4e529 (diff)
Tighten scope of some variables in emem_alloc()
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30491 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/emem.c')
-rw-r--r--epan/emem.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/epan/emem.c b/epan/emem.c
index 188326bb0f..3fa38578ae 100644
--- a/epan/emem.c
+++ b/epan/emem.c
@@ -593,12 +593,11 @@ static void *
emem_alloc(size_t size, emem_header_t *mem, gboolean use_chunks, guint8 *canary)
{
void *buf;
- void *cptr;
- guint8 pad;
- emem_chunk_t *free_list;
if (use_chunks) {
gboolean use_canary = canary != NULL;
+ guint8 pad;
+ emem_chunk_t *free_list;
/* Round up to an 8 byte boundary. Make sure we have at least
* 8 pad bytes for our canary.
*/
@@ -667,7 +666,7 @@ emem_alloc(size_t size, emem_header_t *mem, gboolean use_chunks, guint8 *canary)
free_list->free_offset += (unsigned int) size;
if (use_canary) {
- cptr = (char *)buf + size - pad;
+ void *cptr = (char *)buf + size - pad;
memcpy(cptr, canary, pad);
free_list->canary_info->canary[free_list->canary_info->c_count] = cptr;
free_list->canary_info->cmp_len[free_list->canary_info->c_count] = pad;