Skip to content

Commit 1b7ee6d

Browse files
committed
Fix com_safearray_proxy related memory management issues
1 parent 75ac3f1 commit 1b7ee6d

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
@@ -114,6 +114,8 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
114114
Z_STRLEN(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v,
115115
proxy->dimensions, args, 0);
116116

117+
efree(args);
118+
117119
if (res == SUCCESS) {
118120
php_com_zval_from_variant(rv, &v, proxy->obj->code_page);
119121
VariantClear(&v);
@@ -387,7 +389,7 @@ static zend_object* saproxy_clone(zval *object)
387389
memcpy(cloneproxy, proxy, sizeof(*cloneproxy));
388390

389391
Z_ADDREF_P(cloneproxy->zobj);
390-
cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval *), 0);
392+
cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval), 0);
391393
clone_indices(cloneproxy, proxy, proxy->dimensions);
392394

393395
return &cloneproxy->std;
@@ -437,7 +439,7 @@ int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index)
437439
}
438440

439441
Z_ADDREF_P(proxy->zobj);
440-
proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval *), 0);
442+
proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval), 0);
441443

442444
if (rel) {
443445
clone_indices(proxy, rel, rel->dimensions);

0 commit comments

Comments
 (0)