Skip to content
This repository was archived by the owner on Nov 14, 2024. It is now read-only.

mutex memory leak in ph7_vm_release (with patch) #8

Open
tarkin000 opened this issue Mar 15, 2015 · 1 comment
Open

mutex memory leak in ph7_vm_release (with patch) #8

tarkin000 opened this issue Mar 15, 2015 · 1 comment
Assignees

Comments

@tarkin000
Copy link

Latest clone, on Debian 7 i686 (x32), gcc 4.7.2 (Debian 4.7.2-5)
-DPH7_ENABLE_MATH_FUNC -DPH7_ENABLE_THREADS

Valgrind reports a definite memory loss of 112 bytes.
The loss starts when a recursive mutex is created in ProcessScript (60601).
When ph7_vm_release is called, the mutex is not released.

This patch fixes that.

---------8<-----------------------------------8<---------------------------------------------8<--------------------------
--- ph7.oem 2015-03-15 11:58:17.430116368 -0400
+++ ph7.c 2015-03-15 11:55:36.150961417 -0400
@@ -60873,6 +60873,8 @@
 #if defined(PH7_ENABLE_THREADS)
   /* Leave VM mutex */
   SyMutexLeave(sMPGlobal.pMutexMethods,pVm->pMutex); /* NO-OP if sMPGlobal.nThreadingLevel != PH7_THREAD_LEVEL_MULTI */
+  /* free VM mutex PATCH by SGM 15-MAR-2015 */
+  SyMutexRelease(sMPGlobal.pMutexMethods,pVm->pMutex);
 #endif
  if( rc == PH7_OK ){
    /* Unlink from the list of active VM */
----------------------------->8------------------------->8-------------------------------------->8-----------------------

Hope this helps.

@symisc symisc self-assigned this Mar 15, 2015
@symisc
Copy link
Owner

symisc commented Mar 15, 2015

All right, Thx!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants