Comment 4 for bug 1069897

Revision history for this message
James Hunt (jamesodhunt) wrote :

I agree with Dave's comments in #3.

However, taking a closer look at gdb/cli/cli-cmds.c, I think further changes need to be made to remove all possibility of a crash. The behaviour of source_script_with_search() looks rather unusual in the para-phrased snippet below (my comments prefixed by '/* XXX: '):

#-----------------------------------

old_cleanups = make_cleanup (xfree, full_path);

make_cleanup_fclose (stream);

if (stream == NULL)
{
/* XXX: since a cleanup was added for 'stream' before checking it opened correctly, this appears to *guarantee* a crash if it didn't */
}

if (from_tty == -1)
{
    /* XXX: ? this is already been done above */
    make_cleanup_fclose (stream);
}
#-----------------------------------