diff options
author | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-12-30 06:36:50 +0000 |
---|---|---|
committer | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-12-30 06:36:50 +0000 |
commit | 9a181f777daedf6708c777f33f893b3c7d60f381 (patch) | |
tree | 9fed99c4d49b2a0aee6ef6176d4359881d1578e8 /src/common | |
parent | 2bea002afd6c8bb1f91a6e8a57f269efb1c4b080 (diff) | |
download | hercules-9a181f777daedf6708c777f33f893b3c7d60f381.tar.gz hercules-9a181f777daedf6708c777f33f893b3c7d60f381.tar.bz2 hercules-9a181f777daedf6708c777f33f893b3c7d60f381.tar.xz hercules-9a181f777daedf6708c777f33f893b3c7d60f381.zip |
* Trully fixed the previous commits. (missing casts and incomplete sizes)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11996 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/malloc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/common/malloc.c b/src/common/malloc.c index 7f1d60b29..f2866e564 100644 --- a/src/common/malloc.c +++ b/src/common/malloc.c @@ -230,7 +230,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func ) unit_head_large_first = p; #ifdef DEBUG_MEMMGR // set allocated data to 0xCD (clean memory) - memset(p + sizeof(struct unit_head_large) - sizeof(int), 0xCD, size); + memset((char *)p + sizeof(struct unit_head_large) - sizeof(int), 0xCD, size); #endif *(int*)((char*)p + sizeof(struct unit_head_large) - sizeof(int) + size) = 0xdeadbeaf; return (char *)p + sizeof(struct unit_head_large) - sizeof(int); @@ -292,7 +292,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func ) head->file = file; #ifdef DEBUG_MEMMGR // set allocated memory to 0xCD (clean memory) - memset(head + sizeof(struct unit_head) - sizeof(int), 0xCD, size); + memset((char *)head + sizeof(struct unit_head) - sizeof(int), 0xCD, size); #endif *(int*)((char*)head + sizeof(struct unit_head) - sizeof(int) + size) = 0xdeadbeaf; return (char *)head + sizeof(struct unit_head) - sizeof(int); @@ -379,7 +379,7 @@ void _mfree(void *ptr, const char *file, int line, const char *func ) memmgr_usage_bytes -= head->size; #ifdef DEBUG_MEMMGR // set freed memory to 0xDD (dead memory) - memset(ptr, 0xDD, size_hash - sizeof(struct unit_head_large) + sizeof(int) ); + memset(ptr, 0xDD, head->size); #endif FREE(head_large,file,line,func); } else { @@ -398,7 +398,7 @@ void _mfree(void *ptr, const char *file, int line, const char *func ) head->block = NULL; #ifdef DEBUG_MEMMGR // set freed memory to 0xDD (dead memory) - memset(ptr, 0xDD, head->size - sizeof(struct unit_head) + sizeof(int) ); + memset(ptr, 0xDD, head->size); #endif memmgr_usage_bytes -= head->size; if(--block->unit_used == 0) { |