If the descriptor's refcount drops to zero, we have to unmap the
respective file view, to avoid leaking memory.
. Fixed bug #78982 (pdo_pgsql returns dead persistent connection). (SATŌ
Kentarō)
+- Shmop:
+ . Fixed bug #78538 (shmop memory leak). (cmb)
+
18 Dec 2019, PHP 7.3.13
- Bcmath:
TSRM_API int shmdt(const void *shmaddr)
{/*{{{*/
shm_pair *shm = shm_get(0, (void*)shmaddr);
+ int ret;
if (!shm->segment) {
return -1;
shm->descriptor->shm_lpid = getpid();
shm->descriptor->shm_nattch--;
- return UnmapViewOfFile(shm->addr) ? 0 : -1;
+ ret = UnmapViewOfFile(shm->addr) ? 0 : -1;
+ if (!ret && shm->descriptor->shm_nattch <= 0) {
+ ret = UnmapViewOfFile(shm->descriptor) ? 0 : -1;
+ shm->descriptor = NULL;
+ }
+ return ret;
}/*}}}*/
TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf)