]> git.kaiwu.me - nginx.git/commitdiff
fix potential double free(),
authorIgor Sysoev <igor@sysoev.ru>
Thu, 19 Jul 2007 19:11:57 +0000 (19:11 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Thu, 19 Jul 2007 19:11:57 +0000 (19:11 +0000)
found by Coverity's Scan

src/core/ngx_file.c

index 55cfd7ca26b9dd8a3165e3ba0ba69db85ab3b07d..fcb8ff0802db85186210668f648b044ff2083774 100644 (file)
@@ -518,6 +518,9 @@ ngx_walk_tree(ngx_tree_ctx_t *ctx, ngx_str_t *tree)
         }
 
         ctx->data = data;
+
+    } else {
+        data = NULL;
     }
 
     for ( ;; ) {
@@ -643,8 +646,8 @@ done:
         ngx_free(buf.data);
     }
 
-    if (ctx->alloc) {
-        ngx_free(ctx->data);
+    if (data) {
+        ngx_free(data);
         ctx->data = prev;
     }