summaryrefslogtreecommitdiff
path: root/src/map/party.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/party.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/party.c')
-rw-r--r--src/map/party.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/map/party.c b/src/map/party.c
index 668251b5d..1df916630 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -103,15 +103,17 @@ int party_db_final(DBKey key, DBData *data, va_list ap) {
if( p->instance )
aFree(p->instance);
-
- for( j = 0; j < p->hdatac; j++ ) {
- if( p->hdata[j]->flag.free ) {
- aFree(p->hdata[j]->data);
+
+ if (p->hdata)
+ {
+ for (j = 0; j < p->hdatac; j++) {
+ if (p->hdata[j]->flag.free) {
+ aFree(p->hdata[j]->data);
+ }
+ aFree(p->hdata[j]);
}
- aFree(p->hdata[j]);
- }
- if( p->hdata )
aFree(p->hdata);
+ }
}
return 0;
@@ -609,15 +611,16 @@ int party_broken(int party_id)
if( p->instance )
aFree(p->instance);
- for( j = 0; j < p->hdatac; j++ ) {
- if( p->hdata[j]->flag.free ) {
- aFree(p->hdata[j]->data);
- }
- aFree(p->hdata[j]);
- }
if( p->hdata )
+ {
+ for( j = 0; j < p->hdatac; j++ ) {
+ if( p->hdata[j]->flag.free ) {
+ aFree(p->hdata[j]->data);
+ }
+ aFree(p->hdata[j]);
+ }
aFree(p->hdata);
-
+ }
idb_remove(party->db,party_id);
return 0;
}