This is the mail archive of the gdb-prs@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]

[Bug breakpoints/21553] Double free in gdb when running gdb.linespec/ls-errs.exp


https://sourceware.org/bugzilla/show_bug.cgi?id=21553

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Pedro Alves <palves@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e1e01040aa83ddef0bb5c60a8b187f769b2b1ec3

commit e1e01040aa83ddef0bb5c60a8b187f769b2b1ec3
Author: Pedro Alves <palves@redhat.com>
Date:   Tue Jun 6 15:53:59 2017 +0100

    Fix double free when running gdb.linespec/ls-errs.exp (PR
breakpoints/21553)

    The problem is that b->extra_string is free'ed twice: Once in the
    breakpoint's dtor, and another time via make_cleanup (xfree).

    This patch gets rid of the cleanups, fixing the problem.

    Tested on x86_64 GNU/Linux.

    gdb/ChangeLog:
    2017-06-06  Pedro Alves  <palves@redhat.com>

        PR breakpoints/21553
        * breakpoint.c (create_breakpoints_sal_default)
        (init_breakpoint_sal, create_breakpoint_sal): Use
        gdb::unique_xmalloc_ptr for string parameters.
        (create_breakpoint): Constify 'extra_string' and 'cond_string'
        parameters.  Replace cleanups with gdb::unique_xmalloc_ptr.
        (base_breakpoint_create_breakpoints_sal)
        (bkpt_create_breakpoints_sal, tracepoint_create_breakpoints_sal)
        (strace_marker_create_breakpoints_sal)
        (create_breakpoints_sal_default): Use gdb::unique_xmalloc_ptr for
        string parameters.
        * breakpoint.h (breakpoint_ops::create_breakpoints_sal): Use
        gdb::unique_xmalloc_ptr for string parameters.
        (create_breakpoint): Constify 'extra_string' and 'cond_string'
        parameters.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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