Mercurial > hg > nginx
diff src/stream/ngx_stream_geo_module.c @ 6655:873d7053efb9
Geo: fixed access to already freed memory.
Previously, in "ranges" mode when all added ranges were deleted,
the ctx.high.low[i] was left pointing to a temporary array.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Thu, 18 Aug 2016 17:11:03 +0300 |
parents | 80875b75d27e |
children | ec141a44641b |
line wrap: on
line diff
--- a/src/stream/ngx_stream_geo_module.c +++ b/src/stream/ngx_stream_geo_module.c @@ -436,7 +436,12 @@ ngx_stream_geo_block(ngx_conf_t *cf, ngx for (i = 0; i < 0x10000; i++) { a = (ngx_array_t *) ctx.high.low[i]; - if (a == NULL || a->nelts == 0) { + if (a == NULL) { + continue; + } + + if (a->nelts == 0) { + ctx.high.low[i] = NULL; continue; }