Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] Fix reversed xcalloc() calls in solib-*.c
Date: Tue, 22 Jan 2002 22:27:00 -0000	[thread overview]
Message-ID: <1020123062701.ZM8019@localhost.localdomain> (raw)

I've just committed the following changes.  Thanks to Elena for pointing
this problem out to me.

	* solib-aix5.c (build_so_list_from_mapfile)
	(aix5_relocate_main_executable): Fix xcalloc() calls so order of
	arguments is not reversed.
	* solib-sunos.c (sunos_relocate_main_executable): Likewise.
	* solib-svr4.c (svr4_relocate_main_executable): Likewise.

Index: solib-aix5.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-aix5.c,v
retrieving revision 1.12
diff -u -p -r1.12 solib-aix5.c
--- solib-aix5.c	2001/05/04 04:15:27	1.12
+++ solib-aix5.c	2002/01/23 06:15:49
@@ -262,9 +262,9 @@ build_so_list_from_mapfile (int pid, lon
 
       if (sop == NULL)
 	{
-	  sop = xcalloc (sizeof (struct so_list), 1);
+	  sop = xcalloc (1, sizeof (struct so_list));
 	  make_cleanup (xfree, sop);
-	  sop->lm_info = xcalloc (sizeof (struct lm_info), 1);
+	  sop->lm_info = xcalloc (1, sizeof (struct lm_info));
 	  make_cleanup (xfree, sop->lm_info);
 	  sop->lm_info->mapname = xstrdup (mapname);
 	  make_cleanup (xfree, sop->lm_info->mapname);
@@ -714,8 +714,8 @@ aix5_relocate_main_executable (void)
 
   /* Allocate the data structure which'll contain the new offsets to
      relocate by.  Initialize it so it contains the current offsets.  */
-  new_offsets = xcalloc (sizeof (struct section_offsets),
-                         symfile_objfile->num_sections);
+  new_offsets = xcalloc (symfile_objfile->num_sections,
+			 sizeof (struct section_offsets));
   make_cleanup (xfree, new_offsets);
   for (i = 0; i < symfile_objfile->num_sections; i++)
     new_offsets->offsets[i] = ANOFFSET (symfile_objfile->section_offsets, i);
Index: solib-sunos.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-sunos.c,v
retrieving revision 1.2
diff -u -p -r1.2 solib-sunos.c
--- solib-sunos.c	2001/11/01 16:17:08	1.2
+++ solib-sunos.c	2002/01/23 06:15:50
@@ -728,8 +728,8 @@ sunos_relocate_main_executable (void)
       displacement = pc - bfd_get_start_address (exec_bfd);
       changed = 0;
 
-      new_offsets = xcalloc (sizeof (struct section_offsets),
-			     symfile_objfile->num_sections);
+      new_offsets = xcalloc (symfile_objfile->num_sections,
+			     sizeof (struct section_offsets));
       old_chain = make_cleanup (xfree, new_offsets);
 
       for (i = 0; i < symfile_objfile->num_sections; i++)
Index: solib-svr4.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-svr4.c,v
retrieving revision 1.21
diff -u -p -r1.21 solib-svr4.c
--- solib-svr4.c	2001/11/01 16:17:08	1.21
+++ solib-svr4.c	2002/01/23 06:15:52
@@ -1110,8 +1110,8 @@ svr4_relocate_main_executable (void)
       displacement = pc - bfd_get_start_address (exec_bfd);
       changed = 0;
 
-      new_offsets = xcalloc (sizeof (struct section_offsets),
-			     symfile_objfile->num_sections);
+      new_offsets = xcalloc (symfile_objfile->num_sections,
+			     sizeof (struct section_offsets));
       old_chain = make_cleanup (xfree, new_offsets);
 
       for (i = 0; i < symfile_objfile->num_sections; i++)


                 reply	other threads:[~2002-01-23  6:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1020123062701.ZM8019@localhost.localdomain \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox