diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-12-25 21:41:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-31 23:06:29 +0300 |
commit | f0d5be2db32afc7b4382276ffa3c60a1354bea8e (patch) | |
tree | 919fc1db442339a32a88bde0fa6f68e320e64dce /src/common/HPM.c | |
parent | a71a056abb8931aa4a11d0cde296fe9de68ee6df (diff) | |
download | hercules-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/common/HPM.c')
-rw-r--r-- | src/common/HPM.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c index 51a595310..92b9702d4 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -844,12 +844,13 @@ void hpm_memdown(void) { /* this memory is handled outside of the server's memory manager and thus cleared after memory manager goes down */ - for( i = 0; i < HPM->fnamec; i++ ) { - free(HPM->fnames[i].name); - } - - if( HPM->fnames ) + if (HPM->fnames) + { + for( i = 0; i < HPM->fnamec; i++ ) { + free(HPM->fnames[i].name); + } free(HPM->fnames); + } } int hpm_arg_db_clear_sub(DBKey key, DBData *data, va_list args) { struct HPMArgData *a = DB->data2ptr(data); @@ -863,19 +864,21 @@ void hpm_final(void) { HPM->off = true; - for( i = 0; i < HPM->plugin_count; i++ ) { - HPM->unload(HPM->plugins[i]); - } - if( HPM->plugins ) + { + for( i = 0; i < HPM->plugin_count; i++ ) { + HPM->unload(HPM->plugins[i]); + } aFree(HPM->plugins); - - for( i = 0; i < HPM->symbol_count; i++ ) { - aFree(HPM->symbols[i]); } if( HPM->symbols ) + { + for( i = 0; i < HPM->symbol_count; i++ ) { + aFree(HPM->symbols[i]); + } aFree(HPM->symbols); + } for( i = 0; i < hpPHP_MAX; i++ ) { if( HPM->packets[i] ) |