PH7 icon indicating copy to clipboard operation
PH7 copied to clipboard

mutex memory leak in ph7_vm_release (with patch)

Open tarkin000 opened this issue 9 years ago • 1 comments

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.

tarkin000 avatar Mar 15 '15 16:03 tarkin000

All right, Thx!

symisc avatar Mar 15 '15 21:03 symisc