cedric pushed a commit to branch master.
commit f001cfac383f829b02b164692f37516108c9ccb1
Author: Cedric BAIL <[email protected]>
Date: Fri Apr 5 11:50:54 2013 +0900
eet: do the correct math for allocation.
---
src/lib/eet/eet_dictionary.c | 2 +-
src/lib/eet/eet_lib.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lib/eet/eet_dictionary.c b/src/lib/eet/eet_dictionary.c
index 8bf056a..bdf141a 100644
--- a/src/lib/eet/eet_dictionary.c
+++ b/src/lib/eet/eet_dictionary.c
@@ -132,7 +132,7 @@ eet_dictionary_string_add(Eet_Dictionary *ed,
if (!new_hash) goto on_error;
ed->all_hash = new_hash;
- new_allocated = realloc(ed->all_allocated, total * sizeof (unsigned
char));
+ new_allocated = realloc(ed->all_allocated, ((total >> 3) + 1) * sizeof
(unsigned char));
if (!new_allocated) goto on_error;
ed->all_allocated = new_allocated;
diff --git a/src/lib/eet/eet_lib.c b/src/lib/eet/eet_lib.c
index ceb8847..fd835af 100644
--- a/src/lib/eet/eet_lib.c
+++ b/src/lib/eet/eet_lib.c
@@ -946,7 +946,7 @@ eet_internal_read2(Eet_File *ef)
if (eet_test_close(!ef->ed->all_hash, ef))
return NULL;
- ef->ed->all_allocated = calloc(1, ((num_dictionary_entries >> 8) + 1) *
sizeof (unsigned char));
+ ef->ed->all_allocated = calloc(1, ((num_dictionary_entries >> 3) + 1) *
sizeof (unsigned char));
if (eet_test_close(!ef->ed->all_allocated, ef))
return NULL;
--
------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html