[RFA/Ada(v2) 1/3] Add command to list Ada exceptions

Tom Tromey tromey@redhat.com
Fri Nov 8 15:47:00 GMT 2013


>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> +VEC(ada_exc_info) *
Joel> +ada_exceptions_list (const char *regexp)
Joel> +{
Joel> +  VEC(ada_exc_info) *result = NULL;
Joel> +  struct cleanup *old_chain
Joel> +    = make_cleanup (VEC_cleanup (ada_exc_info), &result);
Joel> +  regex_t *preg = NULL;
Joel> +  int prev_len;
Joel> +
Joel> +  if (regexp != NULL)
Joel> +    {
Joel> +      preg = alloca (sizeof (regex_t));

I think regex_t is sufficiently small that you might as well declare an
object in the outer scope and avoid alloca.

Joel> +  discard_cleanups (old_chain);

This leaks anything done by compile_rx_or_error.  I think you need to
pass an inner cleanup to do_cleanups.

Tom



More information about the Gdb-patches mailing list