Mercurial > hg > nginx
comparison src/core/ngx_slab.c @ 6809:87d7e640b45d
Slab: improved double free detection.
Previously, an attempt to double free the starting page of the
free range was not detected.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Sat, 03 Dec 2016 10:01:39 +0300 |
parents | 2af776c22aec |
children | 88c8c3d65184 |
comparison
equal
deleted
inserted
replaced
6808:2af776c22aec | 6809:87d7e640b45d |
---|---|
595 | 595 |
596 if ((uintptr_t) p & (ngx_pagesize - 1)) { | 596 if ((uintptr_t) p & (ngx_pagesize - 1)) { |
597 goto wrong_chunk; | 597 goto wrong_chunk; |
598 } | 598 } |
599 | 599 |
600 if (slab == NGX_SLAB_PAGE_FREE) { | 600 if (!(slab & NGX_SLAB_PAGE_START)) { |
601 ngx_slab_error(pool, NGX_LOG_ALERT, | 601 ngx_slab_error(pool, NGX_LOG_ALERT, |
602 "ngx_slab_free(): page is already free"); | 602 "ngx_slab_free(): page is already free"); |
603 goto fail; | 603 goto fail; |
604 } | 604 } |
605 | 605 |