[PATCH] gdb: make gdbpy_parse_command_name return a unique_xmalloc_ptr

Andreas Schwab schwab@linux-m68k.org
Tue Mar 23 18:07:06 GMT 2021


On Mär 23 2021, Simon Marchi via Gdb-patches wrote:

> @@ -545,14 +540,19 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
>  	  /* If we have our own "invoke" method, then allow unknown
>  	     sub-commands.  */
>  	  allow_unknown = PyObject_HasAttr (self, invoke_cst);
> -	  cmd = add_prefix_cmd (cmd_name, (enum command_class) cmdtype,
> +	  cmd = add_prefix_cmd (cmd_name.get (),
> +				(enum command_class) cmdtype,
>  				NULL, docstring, &obj->sub_list,
>  				pfx_name, allow_unknown, cmd_list);
>  	}
>        else
> -	cmd = add_cmd (cmd_name, (enum command_class) cmdtype,
> +	cmd = add_cmd (cmd_name.get (), (enum command_class) cmdtype,
>  		       docstring, cmd_list);
>  
> +      /* The above doesn't copy nor take ownership of the name... so we just
> +         leak it.  */

s/leak/release/?

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


More information about the Gdb-patches mailing list