/* gmon_io.c - Input and output from/to gmon.out files.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
- Free Software Foundation, Inc.
+ Copyright (C) 1999-2015 Free Software Foundation, Inc.
This file is part of GNU Binutils.
if (!histograms)
{
num_histograms = 1;
- histograms = xmalloc (sizeof (struct histogram));
+ histograms = (struct histogram *) xmalloc (sizeof (struct histogram));
histograms->lowpc = tmp.low_pc;
histograms->highpc = tmp.high_pc;
histograms->num_bins = hist_num_bins;
hist_scale = (double)((tmp.high_pc - tmp.low_pc) / sizeof (UNIT))
/ hist_num_bins;
- histograms->sample = xmalloc (hist_num_bins * sizeof (int));
+ histograms->sample = (int *) xmalloc (hist_num_bins * sizeof (int));
memset (histograms->sample, 0,
hist_num_bins * sizeof (int));
}
cg_tally (from_pc, self_pc, count);
}
- fclose (ifp);
-
if (hz == HZ_WRONG)
{
/* How many ticks per second? If we can't tell, report
done (1);
}
+ if (ifp != stdin)
+ fclose (ifp);
+
if (output_style & STYLE_GMON_INFO)
{
printf (_("File `%s' (version %d) contains:\n"),