Преглед на файлове

more fix for r released in read_event_handler

tags/v0.4
Brice Figureau преди 18 години
родител
ревизия
ebcfb5a21f
променени са 1 файла, в които са добавени 6 реда и са изтрити 4 реда
  1. 6
    4
      ngx_http_uploadprogress_module.c

+ 6
- 4
ngx_http_uploadprogress_module.c Целия файл

@@ -309,6 +309,7 @@ static void ngx_http_uploadprogress_event_handler(ngx_http_request_t *r)
309 309
     ngx_str_t                                   *id;
310 310
     ngx_slab_pool_t                             *shpool;
311 311
     ngx_connection_t                            *c;
312
+    ngx_shm_zone_t                              *shm_zone;
312 313
     ngx_http_uploadprogress_ctx_t               *ctx;
313 314
     ngx_http_uploadprogress_node_t              *up;
314 315
     ngx_http_uploadprogress_conf_t              *upcf;
@@ -327,6 +328,7 @@ static void ngx_http_uploadprogress_event_handler(ngx_http_request_t *r)
327 328
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
328 329
                    "upload-progress: read_event_handler found id: %V", id);
329 330
     upcf = ngx_http_get_module_loc_conf(r, ngx_http_uploadprogress_module);
331
+    shm_zone = upcf->shm_zone;
330 332
     
331 333
     /* call the original read event handler */
332 334
     module_ctx = ngx_http_get_module_ctx(r, ngx_http_uploadprogress_module);
@@ -335,7 +337,7 @@ static void ngx_http_uploadprogress_event_handler(ngx_http_request_t *r)
335 337
     /* at this stage, r is not anymore safe to use */
336 338
     /* the request could have been closed/freed behind our back */
337 339
     /* and thats the same issue with any other material that was allocated in the request pool */
338
-    /* like id for instance... */
340
+    /* that's why we duplicate id afterward */
339 341
 
340 342
     if (id == NULL) {
341 343
         ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
@@ -343,17 +345,17 @@ static void ngx_http_uploadprogress_event_handler(ngx_http_request_t *r)
343 345
         return;
344 346
     }
345 347
 
346
-    if (upcf->shm_zone == NULL) {
348
+    if (shm_zone == NULL) {
347 349
         ngx_http_uploadprogress_strdupfree(id);
348 350
         ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
349 351
                        "upload-progress: read_event_handler no shm_zone for id: %V", id);
350 352
         return;
351 353
     }
352 354
 
353
-    ctx = upcf->shm_zone->data;
355
+    ctx = shm_zone->data;
354 356
 
355 357
     /* get the original connection of the upload */
356
-    shpool = (ngx_slab_pool_t *) upcf->shm_zone->shm.addr;
358
+    shpool = (ngx_slab_pool_t *) shm_zone->shm.addr;
357 359
 
358 360
     ngx_shmtx_lock(&shpool->mutex);
359 361
 

Loading…
Отказ
Запис