summaryrefslogtreecommitdiff
path: root/src/common/malloc.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-01-20 04:36:08 +0100
committerHaru <haru@dotalux.com>2015-01-20 04:41:33 +0100
commit4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4 (patch)
treedab9d12a6a4b95a37598e27e6e86d6047360d61b /src/common/malloc.c
parent03709c136ad300be631adfd38dc36c2433bda718 (diff)
downloadhercules-4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4.tar.gz
hercules-4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4.tar.bz2
hercules-4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4.tar.xz
hercules-4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4.zip
Minor fixes and tweaks suggested by cppcheck
- Variable scopes reduced - Parenthesized ambiguous expressions - Removed or added NULL checks where (un)necessary - Corrected format strings - Fixed typos potentially leading to bugs Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common/malloc.c')
-rw-r--r--src/common/malloc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/common/malloc.c b/src/common/malloc.c
index 43fbe4ea1..c647dc18f 100644
--- a/src/common/malloc.c
+++ b/src/common/malloc.c
@@ -124,8 +124,7 @@ void aFree_(void *p, const char *file, int line, const char *func)
// ShowMessage("%s:%d: in func %s: aFree %p\n",file,line,func,p);
if (p)
FREE(p, file, line, func);
-
- p = NULL;
+ //p = NULL;
}
@@ -487,13 +486,13 @@ void mfree_(void *ptr, const char *file, int line, const char *func) {
/* Allocating blocks */
static struct block* block_malloc(unsigned short hash)
{
- int i;
struct block *p;
if(hash_unfill[0] != NULL) {
/* Space for the block has already been secured */
p = hash_unfill[0];
hash_unfill[0] = hash_unfill[0]->unfill_next;
} else {
+ int i;
/* Newly allocated space for the block */
p = (struct block*)MALLOC(sizeof(struct block) * (BLOCK_ALLOC), __FILE__, __LINE__, __func__ );
memmgr_usage_bytes_t += sizeof(struct block) * (BLOCK_ALLOC);