This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [OB] Add cleanup, source.c
On Thu, Jun 28, 2007 at 03:27:43PM -0700, msnyder@sonic.net wrote:
> A missed opportunity for cleanup, flagged by Coverity.
>
> I'm cut'and'pasting the patch to avoid my browser turning it into a
> binary stream. This may eliminate tabs, but I don't expect anybody
> to actually apply this with 'patch'...
>
> 2007-06-28 Michael Snyder <msnyder@access-company.com>
>
> * source.c (unset_substitute_path_command): Plug leak (Coverity).
I think you need to do these a little slower...
> /* This function takes either 0 or 1 argument. */
>
> + make_cleanup_freeargv (argv);
> if (argv != NULL && argv[0] != NULL && argv[1] != NULL)
> error (_("Incorrect usage, too many arguments in command"));
There's no call to do_cleanups in this function, so it's quite hard to
see if this cleanup will be run or discarded if error is not called.
--
Daniel Jacobowitz
CodeSourcery