summaryrefslogtreecommitdiff
path: root/modules/mono/mono_gd
diff options
context:
space:
mode:
authorEv1lbl0w <ricasubtil@gmail.com>2021-03-10 18:31:44 +0000
committerEv1lbl0w <ricasubtil@gmail.com>2021-03-13 11:51:45 +0000
commit838e7d0a8d49ac5d2d149acf7afc6b909f640485 (patch)
treef11de0a5cfffb8685f017c912515c7514067333a /modules/mono/mono_gd
parent01851defb5e43803bbcd6d8221a25ebbdd963119 (diff)
Replace malloc's with Godot's memalloc macro
Diffstat (limited to 'modules/mono/mono_gd')
-rw-r--r--modules/mono/mono_gd/support/android_support.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/mono/mono_gd/support/android_support.cpp b/modules/mono/mono_gd/support/android_support.cpp
index cba29d63cd..5dd33b036a 100644
--- a/modules/mono/mono_gd/support/android_support.cpp
+++ b/modules/mono/mono_gd/support/android_support.cpp
@@ -415,8 +415,7 @@ GD_PINVOKE_EXPORT int32_t monodroid_get_system_property(const char *p_name, char
if (r_value) {
if (len >= 0) {
*r_value = (char *)malloc(len + 1);
- if (!*r_value)
- return -1;
+ ERR_FAIL_NULL_V_MSG(*r_value, -1, "Out of memory.");
memcpy(*r_value, prop_value_str, len);
(*r_value)[len] = '\0';
} else {
@@ -637,6 +636,7 @@ GD_PINVOKE_EXPORT int32_t _monodroid_get_dns_servers(void **r_dns_servers_array)
if (dns_servers_count > 0) {
size_t ret_size = sizeof(char *) * (size_t)dns_servers_count;
*r_dns_servers_array = malloc(ret_size); // freed by the BCL
+ ERR_FAIL_NULL_MSG(*r_dns_servers_array, "Out of memory.");
memcpy(*r_dns_servers_array, dns_servers, ret_size);
}