From 62fb73ac2998f7a32c943ff303672ca740b1644c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksey=20Kliger=20=28=CE=BBgeek=29?= Date: Mon, 12 Aug 2019 09:50:58 -0400 Subject: [PATCH] [debugger] Cleanup MonoError on in isFixedSizeArray (mono/mono#16146) 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 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mono/mono/mini/debugger-agent.c b/src/mono/mono/mini/debugger-agent.c index 377d064..208f1fa 100644 --- a/src/mono/mono/mini/debugger-agent.c +++ b/src/mono/mono/mini/debugger-agent.c @@ -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; } -- 2.7.4