comparison 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
comparison
equal deleted inserted replaced
6654:c131f20c9562 6655:873d7053efb9
434 434
435 if (ctx.high.low && !ctx.binary_include) { 435 if (ctx.high.low && !ctx.binary_include) {
436 for (i = 0; i < 0x10000; i++) { 436 for (i = 0; i < 0x10000; i++) {
437 a = (ngx_array_t *) ctx.high.low[i]; 437 a = (ngx_array_t *) ctx.high.low[i];
438 438
439 if (a == NULL || a->nelts == 0) { 439 if (a == NULL) {
440 continue;
441 }
442
443 if (a->nelts == 0) {
444 ctx.high.low[i] = NULL;
440 continue; 445 continue;
441 } 446 }
442 447
443 len = a->nelts * sizeof(ngx_stream_geo_range_t); 448 len = a->nelts * sizeof(ngx_stream_geo_range_t);
444 449