Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / metadata / attach.c
index 0e89624cce35befe8fb6c75d771e24e9d7b98c83..942209fb168b1136dcdca933376ab5d35c16ff25 100644 (file)
@@ -313,7 +313,14 @@ mono_attach_load_agent (MonoDomain *domain, char *agent, char *args, MonoObject
        }
 
        if (args) {
-               mono_array_set (main_args, MonoString*, 0, mono_string_new (domain, args));
+               MonoString *args_str = mono_string_new_checked (domain, args, &error);
+               if (!is_ok (&error)) {
+                       g_print ("Could not allocate main method arg string due to %s\n", mono_error_get_message (&error));
+                       mono_error_cleanup (&error);
+                       g_free (agent);
+                       return 1;
+               }
+               mono_array_set (main_args, MonoString*, 0, args_str);
        }
 
 
@@ -502,7 +509,9 @@ receiver_thread (void *arg)
        MonoInternalThread *internal;
 
        internal = mono_thread_internal_current ();
-       mono_thread_set_name_internal (internal, mono_string_new (mono_domain_get (), "Attach receiver"), TRUE, FALSE, &error);
+       MonoString *attach_str = mono_string_new_checked (mono_domain_get (), "Attach receiver", &error);
+       mono_error_assert_ok (&error);
+       mono_thread_set_name_internal (internal, attach_str, TRUE, FALSE, &error);
        mono_error_assert_ok (&error);
        /* Ask the runtime to not abort this thread */
        //internal->flags |= MONO_THREAD_FLAG_DONT_MANAGE;