[Mono-dev] Unwanted freeing of generic types

Neale Ferguson neale at sinenomine.net
Wed Aug 16 20:57:29 UTC 2017


If there is no error in the first loop do we still want to free each of the type_argv elements in cleanup? If they are these types are overwritten. Freeing type_argv is valid as the mono_class_inflate_generic_type_checked() makes a copy of the array.


        for (i = 0; i < ginst->type_argc; i++) {

                type_argv [i] = mono_class_inflate_generic_type_checked (ginst->type_argv [i], context, error);

                if (!mono_error_ok (error))

                        goto cleanup;

                ++count;

        }


        nginst = mono_metadata_get_generic_inst (ginst->type_argc, type_argv);

cleanup:

        for (i = 0; i < count; i++)

                mono_metadata_free_type (type_argv [i]);

        g_free (type_argv);


        return nginst;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-devel-list/attachments/20170816/65bf8708/attachment.html>


More information about the Mono-devel-list mailing list