Skip to content

Commit 00edc3f

Browse files
committed
Merge branch 'PHP-7.4' into master
* PHP-7.4: Fix com_safearray_proxy related memory management issues
2 parents 55798e0 + 8e2f219 commit 00edc3f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ext/com_dotnet/com_saproxy.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ static zval *saproxy_read_dimension(zend_object *object, zval *offset, int type,
112112
Z_STRLEN(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v,
113113
proxy->dimensions, args, 0);
114114

115+
efree(args);
116+
115117
if (res == SUCCESS) {
116118
php_com_zval_from_variant(rv, &v, proxy->obj->code_page);
117119
VariantClear(&v);
@@ -372,7 +374,7 @@ static zend_object* saproxy_clone(zend_object *object)
372374
memcpy(cloneproxy, proxy, sizeof(*cloneproxy));
373375

374376
GC_ADDREF(&cloneproxy->obj->zo);
375-
cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval *), 0);
377+
cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval), 0);
376378
clone_indices(cloneproxy, proxy, proxy->dimensions);
377379

378380
return &cloneproxy->std;
@@ -422,7 +424,7 @@ int php_com_saproxy_create(zend_object *com_object, zval *proxy_out, zval *index
422424
}
423425

424426
GC_ADDREF(&proxy->obj->zo);
425-
proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval *), 0);
427+
proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval), 0);
426428

427429
if (rel) {
428430
clone_indices(proxy, rel, rel->dimensions);

0 commit comments

Comments
 (0)