From eb61d2d606dacb82c4447dd45c78e4e04f77206e Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Fri, 7 May 2004 00:01:25 +0000 Subject: * dwarf2.c (add_line_info): Also set info->filename to NULL if filename argument is null; do not call strlen on a null pointer. --- bfd/dwarf2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'bfd/dwarf2.c') diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index ceb28af..6182ea9 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -801,10 +801,9 @@ add_line_info (struct line_info_table *table, info->column = column; info->end_sequence = end_sequence; - amt = strlen (filename); - if (amt) + if (filename && filename[0]) { - info->filename = bfd_alloc (table->abfd, amt + 1); + info->filename = bfd_alloc (table->abfd, strlen (filename) + 1); if (info->filename) strcpy (info->filename, filename); } -- cgit v1.1