From fd0a4d7688978ee30c27516619705e2ceccf00f9 Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Wed, 16 Oct 2013 02:55:27 +0000 Subject: [PATCH] There were two functions who were calling "sizeof" twice. The first one, dw2_get_real_path from gdb/dwarf2read.c, was actually making use of OBSTACK_CALLOC which already calls "sizeof" for its third argument. The second, download_tracepoint_1 from gdb/gdbserver/tracepoint.c, was explicitly calling "sizeof" inside another "sizeof". This patch fixed both functions. gdb/ChangeLog 2013-10-16 Sergio Durigan Junior PR gdb/16014 * dwarf2read.c (dw2_get_real_path): Remove unnecessary call to sizeof. gdb/gdbserver/ChangeLog 2013-10-16 Sergio Durigan Junior PR gdb/16014 * tracepoint.c (download_tracepoint_1): Remove unnecessary double call to sizeof. --- gdb/ChangeLog | 6 ++++++ gdb/dwarf2read.c | 2 +- gdb/gdbserver/ChangeLog | 6 ++++++ gdb/gdbserver/tracepoint.c | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b2f1fc8dfa..ab19f6201c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2013-10-16 Sergio Durigan Junior + + PR gdb/16014 + * dwarf2read.c (dw2_get_real_path): Remove unnecessary call to + sizeof. + 2013-10-16 Sergio Durigan Junior PR gdb/16042 diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index aa109e0080..3974d0b2f8 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -3278,7 +3278,7 @@ dw2_get_real_path (struct objfile *objfile, { if (qfn->real_names == NULL) qfn->real_names = OBSTACK_CALLOC (&objfile->objfile_obstack, - qfn->num_file_names, sizeof (char *)); + qfn->num_file_names, char *); if (qfn->real_names[index] == NULL) qfn->real_names[index] = gdb_realpath (qfn->file_names[index]); diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 3138f47868..4f15cfb2cf 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,9 @@ +2013-10-16 Sergio Durigan Junior + + PR gdb/16014 + * tracepoint.c (download_tracepoint_1): Remove unnecessary double + call to sizeof. + 2013-10-02 Pedro Alves * server.c (process_serial_event): Don't output "GDBserver diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c index 3288a139c0..ea1a8a106f 100644 --- a/gdb/gdbserver/tracepoint.c +++ b/gdb/gdbserver/tracepoint.c @@ -6023,7 +6023,7 @@ download_tracepoint_1 (struct tracepoint *tpoint) if (ipa_action != 0) write_inferior_data_ptr - (actions_array + i * sizeof (sizeof (*tpoint->actions)), + (actions_array + i * sizeof (*tpoint->actions), ipa_action); } } -- 2.34.1