List:Commits« Previous MessageNext Message »
From:Stewart Smith Date:May 23 2006 6:51am
Subject:bk commit into 5.0 tree (stewart:1.2137) BUG#19932
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of stewart. When stewart does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2137 06/05/23 14:51:04 stewart@stripped +1 -0
  BUG#19932 mgmapi crash if disconnect in ndb_mgm_get_status
  
  correctly detect and report errors in talking to mgm server and memory allocation

  ndb/src/mgmapi/mgmapi.cpp
    1.61 06/05/23 14:50:59 stewart@stripped +24 -3
    correctly detect and return errors in ndb_mgm_get_status

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	stewart
# Host:	willster.(none)
# Root:	/home/stewart/Documents/MySQL/5.0/bug19932

--- 1.60/ndb/src/mgmapi/mgmapi.cpp	2006-05-17 08:23:26 +10:00
+++ 1.61/ndb/src/mgmapi/mgmapi.cpp	2006-05-23 14:50:59 +10:00
@@ -678,7 +678,11 @@
   out.println("");
 
   char buf[1024];
-  in.gets(buf, sizeof(buf));
+  if(!in.gets(buf, sizeof(buf)))
+  {
+    SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY, "Probably disconnected");
+    return NULL;
+  }
   if(buf[strlen(buf)-1] == '\n')
     buf[strlen(buf)-1] = '\0';
 
@@ -687,7 +691,11 @@
     return NULL;
   }
 
-  in.gets(buf, sizeof(buf));
+  if(!in.gets(buf, sizeof(buf)))
+  {
+    SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY, "Probably disconnected");
+    return NULL;
+  }
   if(buf[strlen(buf)-1] == '\n')
     buf[strlen(buf)-1] = '\0';
   
@@ -710,6 +718,13 @@
     malloc(sizeof(ndb_mgm_cluster_state)+
 	   noOfNodes*(sizeof(ndb_mgm_node_state)+sizeof("000.000.000.000#")));
 
+  if(!state)
+  {
+    SET_ERROR(handle, NDB_MGM_OUT_OF_MEMORY,
+              "Allocating ndb_mgm_cluster_state");
+    return NULL;
+  }
+
   state->no_of_nodes= noOfNodes;
   ndb_mgm_node_state * ptr = &state->node_states[0];
   int nodeId = 0;
@@ -719,7 +734,13 @@
   }
   i = -1; ptr--;
   for(; i<noOfNodes; ){
-    in.gets(buf, sizeof(buf));
+    if(!in.gets(buf, sizeof(buf)))
+    {
+      free(state);
+      SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY,
+                "Probably disconnected");
+      return NULL;
+    }
     tmp.assign(buf);
 
     if(tmp.trim() == ""){
Thread
bk commit into 5.0 tree (stewart:1.2137) BUG#19932Stewart Smith23 May