This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] target_wait/linux_nat_wait: Dump the passed in target options.
- From: Tom Tromey <tromey at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 20 Jul 2012 10:27:29 -0600
- Subject: Re: [PATCH] target_wait/linux_nat_wait: Dump the passed in target options.
- References: <20120720154934.25085.71708.stgit@brno.lan>
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> + if (list == NULL)
Pedro> + return xstrdup (elem);
Pedro> + else
Pedro> + return concat (list, ", ", elem, (char *) NULL);
If list is non-NULL and allocated by malloc, then it will be leaked.
Pedro> +#define DO_TARG_OPTION(OPT) \
Pedro> + ret = do_option (&target_options, ret, OPT, #OPT)
Pedro> +
Pedro> + DO_TARG_OPTION (TARGET_WNOHANG);
Pedro> +
Pedro> + if (target_options != 0)
Pedro> + ret = str_comma_list_concat_elem (ret, "unknown???");
That could conceivably happen here.
I think the fix is just to use
return reconcat (list, list, ", ", elem, (char *) NULL);
Tom