1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix #78538: shmop memory leak
This commit is contained in:
Christoph M. Becker
2020-01-03 18:12:41 +01:00
2 changed files with 10 additions and 1 deletions

3
NEWS
View File

@@ -59,6 +59,9 @@ PHP NEWS
- Session:
. Fixed bug #79031 (Session unserialization problem). (Nikita)
- Shmop:
. Fixed bug #78538 (shmop memory leak). (cmb)
- Sqlite3:
. Fixed bug #79056 (sqlite does not respect PKG_CONFIG_PATH during
compilation). (Nikita)

View File

@@ -720,6 +720,7 @@ TSRM_API void *shmat(int key, const void *shmaddr, int flags)
TSRM_API int shmdt(const void *shmaddr)
{/*{{{*/
shm_pair *shm = shm_get(0, (void*)shmaddr);
int ret;
if (!shm->segment) {
return -1;
@@ -729,7 +730,12 @@ TSRM_API int shmdt(const void *shmaddr)
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)