aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2013-10-14 09:15:09 +0000
committerNick Clifton <nickc@redhat.com>2013-10-14 09:15:09 +0000
commitb2e951ec58973b911515b0770ef859cf9b779533 (patch)
tree1ff43aa3d9c21b43d814854de29f9fed0a19d9ff
parentbb5ce47a22881c8f925459d4622a2126d6a6a751 (diff)
downloadgdb-b2e951ec58973b911515b0770ef859cf9b779533.zip
gdb-b2e951ec58973b911515b0770ef859cf9b779533.tar.gz
gdb-b2e951ec58973b911515b0770ef859cf9b779533.tar.bz2
* gen-aout.c (main): Fix formatting. Close file.
* emultempl/aix.em (_read_file): Close file at end of function. * gas/all/itbl-test.c (main): Close fas. * read.c (add_include_dir): Use xrealloc. * config/tc-score.c (do_macro_bcmp): Initialise inst_main. * config/tc-tic6x.c (tic6x_parse_operand): Initialise second_reg. * readelf.c (decode_arm_unwind): Initialise addr structure. (process_symbol_table): Free lengths. * srcconv.c (wr_sc): Free info. * chew.c (perform): Free next.
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/doc/ChangeLog4
-rw-r--r--bfd/doc/chew.c2
-rw-r--r--bfd/gen-aout.c96
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/readelf.c4
-rw-r--r--binutils/srconv.c1
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-score.c2
-rw-r--r--gas/config/tc-tic6x.c2
-rw-r--r--gas/read.c8
-rw-r--r--gas/testsuite/ChangeLog4
-rw-r--r--gas/testsuite/gas/all/itbl-test.c3
-rw-r--r--ld/ChangeLog4
-rw-r--r--ld/emultempl/aix.em7
15 files changed, 97 insertions, 56 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f7cc20f..f4dcecb 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,7 @@
+2013-10-14 Nick Clifton <nickc@redhat.com>
+
+ * gen-aout.c (main): Fix formatting. Close file.
+
2013-10-13 Richard Sandiford <rdsandiford@googlemail.com>
* elfxx-mips.c (mips_use_local_got_p): New function.
diff --git a/bfd/doc/ChangeLog b/bfd/doc/ChangeLog
index c33eb3b..08c2780 100644
--- a/bfd/doc/ChangeLog
+++ b/bfd/doc/ChangeLog
@@ -1,3 +1,7 @@
+2013-10-14 Nick Clifton <nickc@redhat.com>
+
+ * chew.c (perform): Free next.
+
2013-04-15 Alan Modra <amodra@gmail.com>
* Makefile.am ($(MKDOC)): Append $(EXEEXT_FOR_BUILD) to temp file.
diff --git a/bfd/doc/chew.c b/bfd/doc/chew.c
index f949e1f..b019837 100644
--- a/bfd/doc/chew.c
+++ b/bfd/doc/chew.c
@@ -1256,7 +1256,7 @@ perform ()
fprintf (stderr, "warning, %s is not recognised\n", next);
skip_past_newline ();
}
-
+ free (next);
}
else
skip_past_newline ();
diff --git a/bfd/gen-aout.c b/bfd/gen-aout.c
index 45331e0..5e791ec 100644
--- a/bfd/gen-aout.c
+++ b/bfd/gen-aout.c
@@ -1,6 +1,5 @@
/* Generate parameters for an a.out system.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001, 2002, 2005, 2007
- Free Software Foundation, Inc.
+ Copyright 1990-2013 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -27,58 +26,69 @@
#endif
int
-main (argc, argv)
- int argc; char** argv;
+main (int argc, char** argv)
{
struct exec my_exec;
int page_size;
- char *target = "unknown", *arch = "unknown";
- FILE *file = fopen("gen-aout", "r");
+ char * target;
+ char * arch = "unknown";
+ FILE * file;
- if (file == NULL) {
- fprintf(stderr, "Cannot open gen-aout!\n");
+ target = argv[1];
+ if (target == NULL)
+ {
+ fprintf (stderr, "Usage: gen-aout target_name\n");
+ exit (1);
+ }
+
+ file = fopen ("gen-aout", "r");
+ if (file == NULL)
+ {
+ fprintf (stderr, "Cannot open gen-aout!\n");
return -1;
- }
- if (fread(&my_exec, sizeof(struct exec), 1, file) != 1) {
+ }
+
+ if (fread (&my_exec, sizeof (struct exec), 1, file) != 1)
+ {
fprintf(stderr, "Cannot read gen-aout!\n");
return -1;
- }
+ }
- target = argv[1];
- if (target == NULL) {
- fprintf(stderr, "Usage: gen-aout target_name\n");
- exit (1);
- }
+ fclose (file);
#ifdef N_TXTOFF
page_size = N_TXTOFF(my_exec);
if (page_size == 0)
- printf("#define N_HEADER_IN_TEXT(x) 1\n");
+ printf ("#define N_HEADER_IN_TEXT(x) 1\n");
else
- printf("#define N_HEADER_IN_TEXT(x) 0\n");
+ printf ("#define N_HEADER_IN_TEXT(x) 0\n");
#endif
printf("#define BYTES_IN_WORD %d\n", sizeof (int));
- if (my_exec.a_entry == 0) {
- printf("#define ENTRY_CAN_BE_ZERO\n");
- printf("#define N_SHARED_LIB(x) 0 /* Avoids warning */\n");
- }
- else {
- printf("/*#define ENTRY_CAN_BE_ZERO*/\n");
- printf("/*#define N_SHARED_LIB(x) 0*/\n");
- }
+ if (my_exec.a_entry == 0)
+ {
+ printf ("#define ENTRY_CAN_BE_ZERO\n");
+ printf ("#define N_SHARED_LIB(x) 0 /* Avoids warning */\n");
+ }
+ else
+ {
+ printf ("/*#define ENTRY_CAN_BE_ZERO*/\n");
+ printf ("/*#define N_SHARED_LIB(x) 0*/\n");
+ }
- printf("#define TEXT_START_ADDR %d\n", my_exec.a_entry);
+ printf ("#define TEXT_START_ADDR %d\n", my_exec.a_entry);
#ifdef PAGSIZ
if (page_size == 0)
page_size = PAGSIZ;
#endif
+
if (page_size != 0)
- printf("#define TARGET_PAGE_SIZE %d\n", page_size);
+ printf ("#define TARGET_PAGE_SIZE %d\n", page_size);
else
- printf("/* #define TARGET_PAGE_SIZE ??? */\n");
- printf("#define SEGMENT_SIZE TARGET_PAGE_SIZE\n");
+ printf ("/* #define TARGET_PAGE_SIZE ??? */\n");
+
+ printf ("#define SEGMENT_SIZE TARGET_PAGE_SIZE\n");
#ifdef vax
arch = "vax";
@@ -92,19 +102,19 @@ main (argc, argv)
fprintf (stderr, _(" fix DEFAULT_ARCH in the output file yourself\n"));
arch = "unknown";
}
- printf("#define DEFAULT_ARCH bfd_arch_%s\n\n", arch);
-
- printf("/* Do not \"beautify\" the CONCAT* macro args. Traditional C will not");
- printf(" remove whitespace added here, and thus will fail to concatenate");
- printf(" the tokens. */");
- printf("\n#define MY(OP) CONCAT2 (%s_,OP)\n\n", target);
- printf("#define TARGETNAME \"a.out-%s\"\n\n", target);
-
- printf("#include \"sysdep.h\"\n");
- printf("#include \"bfd.h\"\n");
- printf("#include \"libbfd.h\"\n");
- printf("#include \"libaout.h\"\n");
- printf("\n#include \"aout-target.h\"\n");
+ printf ("#define DEFAULT_ARCH bfd_arch_%s\n\n", arch);
+
+ printf ("/* Do not \"beautify\" the CONCAT* macro args. Traditional C will not");
+ printf (" remove whitespace added here, and thus will fail to concatenate");
+ printf (" the tokens. */");
+ printf ("\n#define MY(OP) CONCAT2 (%s_,OP)\n\n", target);
+ printf ("#define TARGETNAME \"a.out-%s\"\n\n", target);
+
+ printf ("#include \"sysdep.h\"\n");
+ printf ("#include \"bfd.h\"\n");
+ printf ("#include \"libbfd.h\"\n");
+ printf ("#include \"libaout.h\"\n");
+ printf ("\n#include \"aout-target.h\"\n");
return 0;
}
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index d7421c1..078b74d 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2013-10-14 Nick Clifton <nickc@redhat.com>
+
+ * readelf.c (decode_arm_unwind): Initialise addr structure.
+ (process_symbol_table): Free lengths.
+ * srcconv.c (wr_sc): Free info.
+
2013-10-11 Roland McGrath <mcgrathr@google.com>
* winduni.c (languages): Use \345 (octal syntax) rather than
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 19b46c9..32e0cf0 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -7170,7 +7170,7 @@ decode_arm_unwind (struct arm_unw_aux_info * aux,
{
int per_index;
unsigned int more_words = 0;
- struct absaddr addr;
+ struct absaddr addr = { 0 };
bfd_vma sym_name = (bfd_vma) -1;
if (remaining == 0)
@@ -9858,6 +9858,7 @@ process_symbol_table (FILE * file)
counts = (unsigned long *) calloc (maxlength + 1, sizeof (*counts));
if (counts == NULL)
{
+ free (lengths);
error (_("Out of memory\n"));
return 0;
}
@@ -9926,6 +9927,7 @@ process_symbol_table (FILE * file)
counts = (unsigned long *) calloc (maxlength + 1, sizeof (*counts));
if (counts == NULL)
{
+ free (lengths);
error (_("Out of memory\n"));
return 0;
}
diff --git a/binutils/srconv.c b/binutils/srconv.c
index 7b3d4a7..dcf33b9 100644
--- a/binutils/srconv.c
+++ b/binutils/srconv.c
@@ -1578,6 +1578,7 @@ wr_sc (struct coff_ofile *ptr, struct coff_sfile *sfile)
sysroff_swap_sc_out (file, &sc);
scount++;
}
+ free (info);
return scount;
}
diff --git a/gas/ChangeLog b/gas/ChangeLog
index ccc6f04..5d9cc80 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2013-10-14 Nick Clifton <nickc@redhat.com>
+
+ * read.c (add_include_dir): Use xrealloc.
+ * config/tc-score.c (do_macro_bcmp): Initialise inst_main.
+ * config/tc-tic6x.c (tic6x_parse_operand): Initialise second_reg.
+
2013-10-13 Sandra Loosemore <sandra@codesourcery.com>
* config/tc-nios2.c (nios2_consume_arg): Make the "ba" warning
diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c
index 822b9cf..2bb3fbe 100644
--- a/gas/config/tc-score.c
+++ b/gas/config/tc-score.c
@@ -4489,7 +4489,7 @@ s3_do_macro_bcmp (char *str)
char* ptemp;
int i = 0;
struct s3_score_it inst_expand[2];
- struct s3_score_it inst_main;
+ struct s3_score_it inst_main = { 0 };
memset (inst_expand, 0, sizeof inst_expand);
s3_skip_whitespace (str);
diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c
index 81f33f4..fda9cd3 100644
--- a/gas/config/tc-tic6x.c
+++ b/gas/config/tc-tic6x.c
@@ -1596,7 +1596,7 @@ tic6x_parse_operand (char **p, tic6x_operand *op, unsigned int op_forms,
/* See if this looks like a register or register pair. */
if (!operand_parsed && (op_forms & (TIC6X_OP_REG | TIC6X_OP_REGPAIR)))
{
- tic6x_register first_reg, second_reg;
+ tic6x_register first_reg, second_reg = { 0 };
bfd_boolean reg_ok;
char *rq = q;
diff --git a/gas/read.c b/gas/read.c
index 082670c..02f5a25 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -1,7 +1,5 @@
/* read.c - read a source file -
- Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
- 2010, 2011, 2012 Free Software Foundation, Inc.
+ Copyright 1986-2013 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -5794,8 +5792,8 @@ add_include_dir (char *path)
{
include_dir_count++;
include_dirs =
- (char **) realloc (include_dirs,
- include_dir_count * sizeof (*include_dirs));
+ (char **) xrealloc (include_dirs,
+ include_dir_count * sizeof (*include_dirs));
}
include_dirs[include_dir_count - 1] = path; /* New one. */
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 5513867..9100e4b 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2013-10-14 Nick Clifton <nickc@redhat.com>
+
+ * gas/all/itbl-test.c (main): Close fas.
+
2013-10-13 Sandra Loosemore <sandra@codesourcery.com>
* gas/nios2/warn_nobreak.l: Update text of warning messages.
diff --git a/gas/testsuite/gas/all/itbl-test.c b/gas/testsuite/gas/all/itbl-test.c
index 38fcfc5..c00ff1a 100644
--- a/gas/testsuite/gas/all/itbl-test.c
+++ b/gas/testsuite/gas/all/itbl-test.c
@@ -1,6 +1,6 @@
/* itbl-test.c
- Copyright (C) 1997, 2005, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1997-2013 Free Software Foundation.
This file is part of GAS, the GNU Assembler.
@@ -97,6 +97,7 @@ main (int argc, char **argv)
test_reg (3, e_creg, "c2", 22);
test_reg (3, e_dreg, "d3", 3);
+ fclose (fas);
return 0;
}
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 14287dd..b8ebe32 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,7 @@
+2013-10-14 Nick Clifton <nickc@redhat.com>
+
+ * emultempl/aix.em (_read_file): Close file at end of function.
+
2013-10-10 Roland McGrath <mcgrathr@google.com>
* ldmisc.c (vfinfo): Use Boolean ? "" : ":" in place of ":" + Boolean.
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index b48228a..aa72ce6 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -9,9 +9,7 @@ fragment <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* AIX emulation code for ${EMULATION_NAME}
- Copyright 1991, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012
- Free Software Foundation, Inc.
+ Copyright 1991-2013 Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
AIX support by Ian Lance Taylor <ian@cygnus.com>
AIX 64 bit support by Tom Rix <trix@redhat.com>
@@ -1110,6 +1108,7 @@ gld${EMULATION_NAME}_read_file (const char *filename, bfd_boolean import)
{
bfd_set_error (bfd_error_system_call);
einfo ("%F%s: %E\n", filename);
+ return;
}
keep = FALSE;
@@ -1314,6 +1313,8 @@ gld${EMULATION_NAME}_read_file (const char *filename, bfd_boolean import)
obstack_free (o, NULL);
free (o);
}
+
+ fclose (f);
}
/* This routine saves us from worrying about declaring free. */