This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] target_wait/linux_nat_wait: Dump the passed in target options.


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]