Skip to content

Commit

Permalink
Slab: improved double free detection.
Browse files Browse the repository at this point in the history
Previously, an attempt to double free the starting page of the
free range was not detected.
  • Loading branch information
mdocguard committed Dec 3, 2016
1 parent 34b41a7 commit cdd0cd6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/ngx_slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p)
goto wrong_chunk;
}

if (slab == NGX_SLAB_PAGE_FREE) {
if (!(slab & NGX_SLAB_PAGE_START)) {
ngx_slab_error(pool, NGX_LOG_ALERT,
"ngx_slab_free(): page is already free");
goto fail;
Expand Down

0 comments on commit cdd0cd6

Please sign in to comment.