diff options
author | Valentin Bartenev <vbart@nginx.com> | 2016-08-18 17:11:03 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2016-08-18 17:11:03 +0300 |
commit | 535550b406b0f6db18697247c3c132ed502cdd46 (patch) | |
tree | da89b25d9d3038d75d49a0c6ac4ad4dccc6e590b /src/stream/ngx_stream_geo_module.c | |
parent | 50ba1a2cdeeb3f3d826354ac2a5d39f2e052b886 (diff) | |
download | nginx-535550b406b0f6db18697247c3c132ed502cdd46.tar.gz nginx-535550b406b0f6db18697247c3c132ed502cdd46.zip |
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.
Diffstat (limited to 'src/stream/ngx_stream_geo_module.c')
-rw-r--r-- | src/stream/ngx_stream_geo_module.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/stream/ngx_stream_geo_module.c b/src/stream/ngx_stream_geo_module.c index ed1a4886b..32fb9c0f4 100644 --- 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_command_t *cmd, void *conf) 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; } |