[debugger] Cleanup MonoError on in isFixedSizeArray (mono/mono#16146)
authorAleksey Kliger (λgeek) <alklig@microsoft.com>
Mon, 12 Aug 2019 13:50:58 +0000 (09:50 -0400)
committerGitHub <noreply@github.com>
Mon, 12 Aug 2019 13:50:58 +0000 (09:50 -0400)
Cleanup MonoError on error paths.  Also change `return FALSE` to `return 0`.

Addresses Coverity CID 1452205

Commit migrated from https://github.com/mono/mono/commit/dd3f6e0d31a055f616e42561383e0365c8fc6e4c

src/mono/mono/mini/debugger-agent.c

index 377d064..208f1fa 100644 (file)
@@ -3231,8 +3231,7 @@ static gint32 isFixedSizeArray (MonoClassField *f)
        int aindex;
        gint32 ret = 1;
        cinfo = mono_custom_attrs_from_field_checked (f->parent, f, error);
-       if (!is_ok (error))
-               return ret;
+       goto_if_nok (error, leave);
        attr = NULL;
        if (cinfo) {
                for (aindex = 0; aindex < cinfo->num_attrs; ++aindex) {
@@ -3246,8 +3245,10 @@ static gint32 isFixedSizeArray (MonoClassField *f)
 
                                mono_reflection_create_custom_attr_data_args_noalloc (mono_defaults.corlib, attr->ctor, attr->data, attr->data_size,
                                                                                                                                        &typed_args, &named_args, &num_named_args, &arginfo, error);
-                               if (!is_ok (error))
-                                       return FALSE;
+                               if (!is_ok (error)) {
+                                       ret = 0;
+                                       goto leave;
+                               }
                                ret = *(gint32*)typed_args [1];
                                g_free (typed_args);
                                g_free (named_args);
@@ -3256,6 +3257,8 @@ static gint32 isFixedSizeArray (MonoClassField *f)
                        }
                }
        }
+leave:
+       mono_error_cleanup (error);
        return ret;
 }