summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-25 21:41:07 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-31 23:06:29 +0300
commitf0d5be2db32afc7b4382276ffa3c60a1354bea8e (patch)
tree919fc1db442339a32a88bde0fa6f68e320e64dce /src/map/unit.c
parenta71a056abb8931aa4a11d0cde296fe9de68ee6df (diff)
downloadhercules-f0d5be2db32afc7b4382276ffa3c60a1354bea8e.tar.gz
hercules-f0d5be2db32afc7b4382276ffa3c60a1354bea8e.tar.bz2
hercules-f0d5be2db32afc7b4382276ffa3c60a1354bea8e.tar.xz
hercules-f0d5be2db32afc7b4382276ffa3c60a1354bea8e.zip
Add some missing null pointer checks after automatic checks.
Diffstat (limited to 'src/map/unit.c')
-rw-r--r--src/map/unit.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/map/unit.c b/src/map/unit.c
index a5bd282a9..deb061f78 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -2657,14 +2657,16 @@ int unit_free(struct block_list *bl, clr_type clrtype) {
sd->num_quests = sd->avail_quests = 0;
}
- for( k = 0; k < sd->hdatac; k++ ) {
- if( sd->hdata[k]->flag.free ) {
- aFree(sd->hdata[k]->data);
- }
- aFree(sd->hdata[k]);
- }
if( sd->hdata )
+ {
+ for( k = 0; k < sd->hdatac; k++ ) {
+ if( sd->hdata[k]->flag.free ) {
+ aFree(sd->hdata[k]->data);
+ }
+ aFree(sd->hdata[k]);
+ }
aFree(sd->hdata);
+ }
break;
}
case BL_PET:
@@ -2776,14 +2778,16 @@ int unit_free(struct block_list *bl, clr_type clrtype) {
if( md->tomb_nid )
mob->mvptomb_destroy(md);
- for (k = 0; k < md->hdatac; k++) {
- if( md->hdata[k]->flag.free ) {
- aFree(md->hdata[k]->data);
- }
- aFree(md->hdata[k]);
- }
if (md->hdata)
+ {
+ for (k = 0; k < md->hdatac; k++) {
+ if( md->hdata[k]->flag.free ) {
+ aFree(md->hdata[k]->data);
+ }
+ aFree(md->hdata[k]);
+ }
aFree(md->hdata);
+ }
break;
}
case BL_HOM: