summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/malloc.c2
-rw-r--r--src/map/map.c6
-rw-r--r--src/map/map.h4
3 files changed, 8 insertions, 4 deletions
diff --git a/src/common/malloc.c b/src/common/malloc.c
index 6ed1668b9..6eaa994d8 100644
--- a/src/common/malloc.c
+++ b/src/common/malloc.c
@@ -393,7 +393,7 @@ void _mfree(void *ptr, const char *file, int line, const char *func ) {
memmgr_usage_bytes -= head->size;
FREE (head_large);
} else {
- ShowError("Memory manager: args of aFree is freed pointer %s line %d\n", file, line);
+ ShowError("Memory manager: args of aFree is freed pointer %s:%d@%s\n", file, line, func);
}
ptr = NULL;
return;
diff --git a/src/map/map.c b/src/map/map.c
index a26430776..28bdd5148 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -291,13 +291,15 @@ int map_freeblock_lock (void)
* バッファにたまっていたblockを全部削除
*------------------------------------------
*/
-int map_freeblock_unlock (void)
+//Temporal debug function to figure out which unlock is causing already free'd pointer errors.
+int map_freeblock_unlock_sub(const char * file, int line)
{
if ((--block_free_lock) == 0) {
int i;
for (i = 0; i < block_free_count; i++)
{ //Directly calling aFree shouldn't be a leak, as Free remembers the size the original pointed to memory was allocated with? [Skotlex]
- aFree(block_free[i]);
+// aFree(block_free[i]);
+ _mfree(block_free[i], file, line, __func__);
block_free[i] = NULL;
}
block_free_count = 0;
diff --git a/src/map/map.h b/src/map/map.h
index 3853905d9..c0ed9cf16 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1218,7 +1218,9 @@ int map_getusers(void);
// block削除関連
int map_freeblock(struct block_list *bl);
int map_freeblock_lock(void);
-int map_freeblock_unlock(void);
+//int map_freeblock_unlock(void);
+#define map_freeblock_unlock() map_freeblock_unlock_sub(__FILE__, __LINE__)
+int map_freeblock_unlock_sub(const char * file, int line);
// block関連
int map_addblock_sub(struct block_list *, int);
int map_delblock_sub(struct block_list *, int);