From 6bc1a1bf2b8853c98b4068ebee7f0a24b22ee341 Mon Sep 17 00:00:00 2001
From: unknown <hf@deer.(none)>
Date: Mon, 17 May 2004 12:07:58 +0500
Subject: [PATCH] Proposed fix for #3791 (embedded: mysql segfaults if cannot
 find errmsg.sys)

client/mysql.cc:
  Checking of mysql_server_init output added
---
 client/mysql.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/client/mysql.cc b/client/mysql.cc
index ddc6441f08a..b3b1e35bb85 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -374,7 +374,11 @@ int main(int argc,char *argv[])
     exit(1);
   }
   glob_buffer.realloc(512);
-  mysql_server_init(0, NULL, (char**) server_default_groups);
+  if (mysql_server_init(0, NULL, (char**) server_default_groups))
+  {
+    free_defaults(defaults_argv);
+    exit(1);
+  }
   completion_hash_init(&ht, 128);
   init_alloc_root(&hash_mem_root, 16384, 0);
   bzero((char*) &mysql, sizeof(mysql));
-- 
2.30.9