This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] MI error fixes


Hello,

Two tweaks:

- it was forgetting to bail for one error
- was doing a redundant out-of-memory check (the memory was allocated with xcalloc)


committed,
Andrew
2004-06-01  Andrew Cagney  <cagney@gnu.org>

	* mi/mi-main.c (mi_cmd_data_read_memory): Add missing return for
	"invalid number of columns" error.  Delete redundant "out of
	memory" check.

Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.59
diff -p -u -r1.59 mi-main.c
--- mi/mi-main.c	28 Apr 2004 16:36:25 -0000	1.59
+++ mi/mi-main.c	1 Jun 2004 12:54:45 -0000
@@ -886,6 +886,7 @@ mi_cmd_data_read_memory (char *command, 
     {
       xasprintf (&mi_error_message,
 		 "mi_cmd_data_read_memory: invalid number of columns.");
+      return MI_CMD_ERROR;
     }
   /* The un-printable character when printing ascii. */
   if (argc == 6)
@@ -897,12 +898,6 @@ mi_cmd_data_read_memory (char *command, 
   total_bytes = word_size * nr_rows * nr_cols;
   mbuf = xcalloc (total_bytes, 1);
   make_cleanup (xfree, mbuf);
-  if (mbuf == NULL)
-    {
-      xasprintf (&mi_error_message,
-		 "mi_cmd_data_read_memory: out of memory.");
-      return MI_CMD_ERROR;
-    }
   nr_bytes = 0;
   while (nr_bytes < total_bytes)
     {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]