From ba9777bef059df0926ad5dd6813d5785cb652ccf Mon Sep 17 00:00:00 2001 From: Paul Pluzhnikov Date: Mon, 17 Jun 2019 10:49:15 -0700 Subject: [PATCH] PR gdb/24364: Don't call dtrace_process_dof with NULL dof. --- gdb/ChangeLog | 6 ++++++ gdb/dtrace-probe.c | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 51748a80e46..397a08f20b5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2019-06-17 Paul Pluzhnikov + + PR gdb/24364 + * gdb/dtrace-probe.c (dtrace_static_probe_ops::get_probe): Don't + call dtrace_process_dof with NULL dof. + 2019-06-16 Tom de Vries PR gdb/24445 diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c index 52973784e9a..2a2eae1f709 100644 --- a/gdb/dtrace-probe.c +++ b/gdb/dtrace-probe.c @@ -856,13 +856,14 @@ dtrace_static_probe_ops::get_probes /* Read the contents of the DOF section and then process it to extract the information of any probe defined into it. */ - if (!bfd_malloc_and_get_section (abfd, sect, &dof)) + if (bfd_malloc_and_get_section (abfd, sect, &dof) && dof != NULL) + dtrace_process_dof (sect, objfile, probesp, + (struct dtrace_dof_hdr *) dof); + else complaint (_("could not obtain the contents of" "section '%s' in objfile `%s'."), sect->name, abfd->filename); - - dtrace_process_dof (sect, objfile, probesp, - (struct dtrace_dof_hdr *) dof); + xfree (dof); } } -- 2.30.2