summaryrefslogtreecommitdiff
path: root/ext/com_dotnet/com_dotnet.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/com_dotnet/com_dotnet.c')
-rw-r--r--ext/com_dotnet/com_dotnet.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c
index f8bdefdf21..f522436365 100644
--- a/ext/com_dotnet/com_dotnet.c
+++ b/ext/com_dotnet/com_dotnet.c
@@ -205,8 +205,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
char buf[1024];
char *err = php_win32_error_to_msg(hr);
snprintf(buf, sizeof(buf), "Failed to init .Net runtime [%s] %s", where, err);
- if (err)
- LocalFree(err);
+ php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf);
return;
}
@@ -219,8 +218,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
char buf[1024];
char *err = php_win32_error_to_msg(hr);
snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] %s", where, err);
- if (err)
- LocalFree(err);
+ php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf);
ZVAL_NULL(object);
return;
@@ -232,8 +230,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
char buf[1024];
char *err = php_win32_error_to_msg(hr);
snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] %s", where, err);
- if (err)
- LocalFree(err);
+ php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf);
ZVAL_NULL(object);
return;
@@ -315,9 +312,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
char buf[1024];
char *err = php_win32_error_to_msg(hr);
snprintf(buf, sizeof(buf), "Failed to instantiate .Net object [%s] [0x%08x] %s", where, hr, err);
- if (err && err[0]) {
- LocalFree(err);
- }
+ php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf);
return;
}