Skip to content

Commit

Permalink
Merge branch 'PHP-7.3' into PHP-7.4
Browse files Browse the repository at this point in the history
* PHP-7.3:
  Fix com_safearray_proxy related memory management issues
  • Loading branch information
cmb69 committed Aug 26, 2020
2 parents b087bd2 + 1b7ee6d commit 8e2f219
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ext/com_dotnet/com_saproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
Z_STRLEN(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v,
proxy->dimensions, args, 0);

efree(args);

if (res == SUCCESS) {
php_com_zval_from_variant(rv, &v, proxy->obj->code_page);
VariantClear(&v);
Expand Down Expand Up @@ -390,7 +392,7 @@ static zend_object* saproxy_clone(zval *object)
memcpy(cloneproxy, proxy, sizeof(*cloneproxy));

Z_ADDREF_P(cloneproxy->zobj);
cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval *), 0);
cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval), 0);
clone_indices(cloneproxy, proxy, proxy->dimensions);

return &cloneproxy->std;
Expand Down Expand Up @@ -440,7 +442,7 @@ int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index)
}

Z_ADDREF_P(proxy->zobj);
proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval *), 0);
proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval), 0);

if (rel) {
clone_indices(proxy, rel, rel->dimensions);
Expand Down

0 comments on commit 8e2f219

Please sign in to comment.