summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-09-09 17:32:40 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-09-09 17:32:40 +0000
commit52a4daf41b424d72923ac32fea98dcfa47266916 (patch)
treebf390666308af33e4c433cc6fec482f62980c60f /src/map
parentf7a7b1d041ff396d96468be30bc4914e626979b3 (diff)
downloadhercules-52a4daf41b424d72923ac32fea98dcfa47266916.tar.gz
hercules-52a4daf41b424d72923ac32fea98dcfa47266916.tar.bz2
hercules-52a4daf41b424d72923ac32fea98dcfa47266916.tar.xz
hercules-52a4daf41b424d72923ac32fea98dcfa47266916.zip
- Added a crash protection in case mapfreeblock unlock tries to free a null pointer.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8688 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/map.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 492283125..c57902f32 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -271,6 +271,7 @@ unsigned int distance(int dx, int dy) {
*/
int map_freeblock (struct block_list *bl)
{
+ nullpo_retr(block_free_lock, bl);
if (block_free_lock == 0 || block_free_count >= block_free_max)
{
aFree(bl);
@@ -308,7 +309,7 @@ int map_freeblock_unlock_sub(char *file, int lineno)
{ //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]);
// _mfree(block_free[i], file, lineno, __func__);
- _mfree(block_free[i], file, block_free[i]->type*100000+lineno, __func__);
+ _mfree(block_free[i], file, ((block_free[i]?block_free[i]->type:0)*100000)+lineno, __func__);
block_free[i] = NULL;
}
block_free_count = 0;