summaryrefslogtreecommitdiff
path: root/src/common/HPM.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-10-14 01:33:24 +0300
committerGitHub <noreply@github.com>2016-10-14 01:33:24 +0300
commit1b1682ed243ef8304bfce1be7a70626c95720d93 (patch)
tree7d59d93dca969c4f884218a9451f15f1833fc82c /src/common/HPM.c
parentb75799528a1394919fd5eb4c8763a96ee80a9325 (diff)
parent230de7dd1ec428c3a6274de3724cda284dea33e6 (diff)
downloadhercules-1b1682ed243ef8304bfce1be7a70626c95720d93.tar.gz
hercules-1b1682ed243ef8304bfce1be7a70626c95720d93.tar.bz2
hercules-1b1682ed243ef8304bfce1be7a70626c95720d93.tar.xz
hercules-1b1682ed243ef8304bfce1be7a70626c95720d93.zip
Merge pull request #1477 from HerculesWS/memmgr-hpm-fixes
Fixed a memory manager crash when a memory leak occurs in a plugin
Diffstat (limited to 'src/common/HPM.c')
-rw-r--r--src/common/HPM.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c
index ff1371b14..1fad7102f 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -567,6 +567,7 @@ struct hplugin *hplugin_load(const char* filename)
/* id */
plugin->hpi->pid = plugin->idx;
/* core */
+ plugin->hpi->memmgr = HPMiMalloc;
#ifdef CONSOLE_INPUT
plugin->hpi->addCPCommand = console->input->addCommand;
#endif // CONSOLE_INPUT
@@ -1093,8 +1094,8 @@ void hpm_init(void)
HPM->off = false;
- memcpy(&iMalloc_HPM, iMalloc, sizeof(struct malloc_interface));
HPMiMalloc = &iMalloc_HPM;
+ *HPMiMalloc = *iMalloc;
HPMiMalloc->malloc = HPM_mmalloc;
HPMiMalloc->calloc = HPM_calloc;
HPMiMalloc->realloc = HPM_realloc;