From d5c7d8500107271571f13baa54b246827e134143 Mon Sep 17 00:00:00 2001
From: unknown <stewart@mysql.com>
Date: Tue, 7 Dec 2004 15:49:54 +1100
Subject: [PATCH] Fix segmentation fault on incorrect configuration.

Starting ndb_mgmd on a host which isn't in the configuration file as the ndb_mgmd
(e.g. the ip address is different) would have ndb_mgmd segfault.

There was a check in the code, but it was (potentially) trying to dereference null


ndb/src/mgmsrv/MgmtSrvr.cpp:
  Don't try and print client_addr->sin_addr if client_addr is null
---
 ndb/src/mgmsrv/MgmtSrvr.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp
index 061aa2e0cb..4dd1f7cf08 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.cpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.cpp
@@ -2292,8 +2292,9 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
       if (found_matching_type)
 	if (found_free_node)
 	  error_string.appfmt("Connection done from wrong host ip %s.",
-			      inet_ntoa(((struct sockaddr_in *)
-					 (client_addr))->sin_addr));
+			      (client_addr)?
+			        inet_ntoa(((struct sockaddr_in *)
+					 (client_addr))->sin_addr):"");
 	else
 	  error_string.appfmt("No free node id found for %s.",
 			      type_string.c_str());
-- 
2.30.9