summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-06-26 16:05:07 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-06-26 16:05:07 +0000
commit6ec58f4e48829623d74c6efd3d978ba0d96e3604 (patch)
treecbc666278e311363f28861c6cabd4bd1e27f32e8
parent3ca6e914862e0686ad0812d2ee281b907812e0d6 (diff)
downloadhercules-6ec58f4e48829623d74c6efd3d978ba0d96e3604.tar.gz
hercules-6ec58f4e48829623d74c6efd3d978ba0d96e3604.tar.bz2
hercules-6ec58f4e48829623d74c6efd3d978ba0d96e3604.tar.xz
hercules-6ec58f4e48829623d74c6efd3d978ba0d96e3604.zip
* Fixed a signed literal being assigned to an unsigned variable and other minor cleanups in malloc (bugreport:4765).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14869 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--src/common/malloc.c8
2 files changed, 3 insertions, 6 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index f0b8df90d..65cc02c9d 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -1,6 +1,7 @@
Date Added
2011/06/26
+ * Fixed a signed literal being assigned to an unsigned variable and other minor cleanups in malloc (bugreport:4765). [Ai4rei]
* Fixed @mobinfo displaying mvp rewards with 'AegisName' although normal drops use 'Name' item db column (bugreport:4981, follow up to r6346). [Ai4rei]
* Fixed quest index memory corruption when adding new quests (since r14039, bugreport:4982) [ultramage]
2011/06/25
diff --git a/src/common/malloc.c b/src/common/malloc.c
index b566e689f..a52d2337a 100644
--- a/src/common/malloc.c
+++ b/src/common/malloc.c
@@ -222,7 +222,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func )
if (((long) size) < 0) {
ShowError("_mmalloc: %d\n", size);
- return 0;
+ return NULL;
}
if(size == 0) {
@@ -380,7 +380,7 @@ void _mfree(void *ptr, const char *file, int line, const char *func )
{
ShowError("Memory manager: args of aFree 0x%p is overflowed pointer %s line %d\n", ptr, file, line);
} else {
- head->size = -1;
+ head->size = 0xFFFF;
if(head_large->prev) {
head_large->prev->next = head_large->next;
} else {
@@ -636,7 +636,6 @@ static void memmgr_final (void)
fclose(log_fp);
}
#endif /* LOG_MEMMGR */
- return;
}
static void memmgr_init (void)
@@ -646,7 +645,6 @@ static void memmgr_init (void)
ShowStatus("Memory manager initialised: "CL_WHITE"%s"CL_RESET"\n", memmer_logfile);
memset(hash_unfill, 0, sizeof(hash_unfill));
#endif /* LOG_MEMMGR */
- return;
}
#endif /* USE_MEMMGR */
@@ -679,7 +677,6 @@ void malloc_final (void)
#ifdef USE_MEMMGR
memmgr_final ();
#endif
- return;
}
void malloc_init (void)
@@ -687,5 +684,4 @@ void malloc_init (void)
#ifdef USE_MEMMGR
memmgr_init ();
#endif
- return;
}