fix uninitialized field in ada-lang.c (struct match_data)
authorJoel Brobecker <brobecker@gnat.com>
Wed, 14 Dec 2011 20:24:59 +0000 (20:24 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Wed, 14 Dec 2011 20:24:59 +0000 (20:24 +0000)
Field found_sym in add_nonlocal_symbols's struct match_data is
used uninitialized.  Rather than adding the initialization of
this field (to zero), we set the entire structure to zero first,
and then set the fields that need to be initialized to non-zero
next.

gdb/ChangeLog:

        * ada-lang.c (add_nonlocal_symbols): Initialize data to
        all zeros.  Remove setting of data.arg_sym to NULL.

gdb/ChangeLog
gdb/ada-lang.c

index 951e9fd64e4ece3baf192826d6519757946a641d..1db38949869a2fe3bc8da0a90ffa5f6ebf44404b 100644 (file)
@@ -1,3 +1,8 @@
+2011-12-14  Joel Brobecker  <brobecker@adacore.com>
+
+       * ada-lang.c (add_nonlocal_symbols): Initialize data to
+       all zeros.  Remove setting of data.arg_sym to NULL.
+
 2011-12-14  Pedro Alves  <pedro@codesourcery.com>
 
        PR threads/10729
index 33d7253f577d81e56341e4af1ef2ce90df9eae2c..1befc43e9318ad63044610e3c184b9fab001a1df 100644 (file)
@@ -4922,8 +4922,8 @@ add_nonlocal_symbols (struct obstack *obstackp, const char *name,
   struct objfile *objfile;
   struct match_data data;
 
+  memset (&data, 0, sizeof data);
   data.obstackp = obstackp;
-  data.arg_sym = NULL;
 
   ALL_OBJFILES (objfile)
     {