Skip to content

Commit 8e2f219

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix com_safearray_proxy related memory management issues
2 parents b087bd2 + 1b7ee6d commit 8e2f219

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ext/com_dotnet/com_saproxy.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
115115
Z_STRLEN(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v,
116116
proxy->dimensions, args, 0);
117117

118+
efree(args);
119+
118120
if (res == SUCCESS) {
119121
php_com_zval_from_variant(rv, &v, proxy->obj->code_page);
120122
VariantClear(&v);
@@ -390,7 +392,7 @@ static zend_object* saproxy_clone(zval *object)
390392
memcpy(cloneproxy, proxy, sizeof(*cloneproxy));
391393

392394
Z_ADDREF_P(cloneproxy->zobj);
393-
cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval *), 0);
395+
cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval), 0);
394396
clone_indices(cloneproxy, proxy, proxy->dimensions);
395397

396398
return &cloneproxy->std;
@@ -440,7 +442,7 @@ int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index)
440442
}
441443

442444
Z_ADDREF_P(proxy->zobj);
443-
proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval *), 0);
445+
proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval), 0);
444446

445447
if (rel) {
446448
clone_indices(proxy, rel, rel->dimensions);

0 commit comments

Comments
 (0)