diff options
author | Mark Wielaard <mjw@redhat.com> | 2015-05-06 12:45:49 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2015-05-12 16:41:05 +0200 |
commit | a3344c7a785888ecd31475efaaf456db41897423 (patch) | |
tree | dcaf41838f0ce38640adf7fcbd209e06685d127f /src/nm.c | |
parent | ae02916ba11547418c749ab0bebeb59c6094b96c (diff) | |
download | elfutils-a3344c7a785888ecd31475efaaf456db41897423.tar.gz |
nm: Handle dwarf_linesrc returning NULL.
https://bugzilla.redhat.com/show_bug.cgi?id=1170810#32
Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'src/nm.c')
-rw-r--r-- | src/nm.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -1297,11 +1297,10 @@ show_symbols (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Elf_Scn *xndxscn, /* We found the line. */ int lineno; (void) dwarf_lineno (line, &lineno); + const char *file = dwarf_linesrc (line, NULL, NULL); + file = (file != NULL) ? basename (file) : "???"; int n; - n = obstack_printf (&whereob, "%s:%d%c", - basename (dwarf_linesrc (line, - NULL, - NULL)), + n = obstack_printf (&whereob, "%s:%d%c", file, lineno, '\0'); sym_mem[nentries_used].where = obstack_finish (&whereob); |