Browse Source

No need to free PHP persistent list entry

Stanley Cheung 8 years ago
parent
commit
0cf189ebaa
3 changed files with 6 additions and 13 deletions
  1. 1 3
      package.xml
  2. 4 7
      src/php/ext/grpc/channel.c
  3. 1 3
      templates/package.xml.template

+ 1 - 3
package.xml

@@ -22,9 +22,7 @@
  </stability>
  </stability>
  <license>BSD</license>
  <license>BSD</license>
  <notes>
  <notes>
-- Fixed a Windows installation issue #12108
-- Fixed a MacOS mutex segfault #12109
-- Fixed a ZTS compilation issue #12109
+- Fixed segfault when tests were run under Travis #12123
  </notes>
  </notes>
  <contents>
  <contents>
   <dir baseinstalldir="/" name="/">
   <dir baseinstalldir="/" name="/">

+ 4 - 7
src/php/ext/grpc/channel.c

@@ -434,11 +434,11 @@ PHP_METHOD(Channel, close) {
     grpc_channel_destroy(channel->wrapper->wrapped);
     grpc_channel_destroy(channel->wrapper->wrapped);
     free(channel->wrapper->target);
     free(channel->wrapper->target);
     channel->wrapper->wrapped = NULL;
     channel->wrapper->wrapped = NULL;
-  }
 
 
-  php_grpc_delete_persistent_list_entry(channel->wrapper->key,
-                                        strlen(channel->wrapper->key)
-                                        TSRMLS_CC);
+    php_grpc_delete_persistent_list_entry(channel->wrapper->key,
+                                          strlen(channel->wrapper->key)
+                                          TSRMLS_CC);
+  }
   gpr_mu_unlock(&channel->wrapper->mu);
   gpr_mu_unlock(&channel->wrapper->mu);
 }
 }
 
 
@@ -467,12 +467,9 @@ static void php_grpc_channel_plink_dtor(php_grpc_zend_resource *rsrc
     if (le->channel->wrapped != NULL) {
     if (le->channel->wrapped != NULL) {
       grpc_channel_destroy(le->channel->wrapped);
       grpc_channel_destroy(le->channel->wrapped);
       free(le->channel->target);
       free(le->channel->target);
-      free(le->channel->key);
-      free(le->channel);
     }
     }
     gpr_mu_unlock(&le->channel->mu);
     gpr_mu_unlock(&le->channel->mu);
   }
   }
-  free(le);
 }
 }
 
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_construct, 0, 0, 2)
 ZEND_BEGIN_ARG_INFO_EX(arginfo_construct, 0, 0, 2)

+ 1 - 3
templates/package.xml.template

@@ -24,9 +24,7 @@
    </stability>
    </stability>
    <license>BSD</license>
    <license>BSD</license>
    <notes>
    <notes>
-  - Fixed a Windows installation issue #12108
-  - Fixed a MacOS mutex segfault #12109
-  - Fixed a ZTS compilation issue #12109
+  - Fixed segfault when tests were run under Travis #12123
    </notes>
    </notes>
    <contents>
    <contents>
     <dir baseinstalldir="/" name="/">
     <dir baseinstalldir="/" name="/">