]> granicus.if.org Git - php/commitdiff
Don't keep dangling pointers
authorDmitry Stogov <dmitry@zend.com>
Wed, 23 Sep 2015 13:16:04 +0000 (16:16 +0300)
committerDmitry Stogov <dmitry@zend.com>
Wed, 23 Sep 2015 13:16:04 +0000 (16:16 +0300)
sapi/cgi/cgi_main.c
sapi/litespeed/lsapi_main.c

index e76da2a5b1d43ac657c1b309ab7f4e8c9d63107b..62934704724d4ef32e2686ce70b3cc8176a2bd87 100644 (file)
@@ -2353,7 +2353,10 @@ consult the installation file that came with this distribution, or visit \n\
                                                goto fastcgi_request_done;
                                        }
 
-                                       if (SG(request_info).path_translated) efree(SG(request_info).path_translated);
+                                       if (SG(request_info).path_translated) {
+                                               efree(SG(request_info).path_translated);
+                                               SG(request_info).path_translated = NULL;
+                                       }
 
                                        if (free_query_string && SG(request_info).query_string) {
                                                free(SG(request_info).query_string);
@@ -2487,7 +2490,10 @@ consult the installation file that came with this distribution, or visit \n\
 
 fastcgi_request_done:
                        {
-                               if (SG(request_info).path_translated) efree(SG(request_info).path_translated);
+                               if (SG(request_info).path_translated) {
+                                       efree(SG(request_info).path_translated);
+                                       SG(request_info).path_translated = NULL;
+                               }
 
                                php_request_shutdown((void *) 0);
 
index e58587dbe3e4d65ad2d74d0b82a601f3d6132282..13bca0cab3f0a0044d8169ce3b195be75f775f45 100644 (file)
@@ -173,6 +173,7 @@ static int sapi_lsapi_deactivate(void)
     if ( SG(request_info).path_translated )
     {
         efree( SG(request_info).path_translated );
+        SG(request_info).path_translated = NULL;
     }
 
     return SUCCESS;