From: Date: September 14 2006 12:12am Subject: bk commit into 5.0 tree (hartmut:1.2263) BUG#17582 List-Archive: http://lists.mysql.com/commits/11900 X-Bug: 17582 Message-Id: <20060913221224.A3F5E2840A2@linux.site> Below is the list of changes that have just been committed into a local 5.0 repository of hartmut. When hartmut 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@stripped, 2006-09-14 00:12:17+02:00, hartmut@stripped +1 -0 Changed to use NdbAutoPtr instead of explicit free() calls as suggested by Jonas (still Bug #17582) ndb/tools/ndb_config.cpp@stripped, 2006-09-14 00:12:14+02:00, hartmut@stripped +3 -9 Changed to use NdbAutoPtr instead of explicit free() calls as suggested by Jonas (still Bug #17582) # 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: hartmut # Host: linux.site # Root: /home/hartmut/projects/mysql/dev/teamtrees/mysql-5.0-ndb --- 1.16/ndb/tools/ndb_config.cpp 2006-09-14 00:12:24 +02:00 +++ 1.17/ndb/tools/ndb_config.cpp 2006-09-14 00:12:24 +02:00 @@ -31,6 +31,7 @@ #include #include #include +#include static int g_verbose = 0; static int try_reconnect = 3; @@ -381,7 +382,6 @@ { struct hostent *h1, *h2, copy1; char *addr1; - int stat; h1 = gethostbyname(m_value.c_str()); if (h1 == NULL) { @@ -392,30 +392,24 @@ // so we need to copy the results before doing the next call memcpy(©1, h1, sizeof(struct hostent)); addr1 = (char *)malloc(copy1.h_length); + NdbAutoPtr tmp_aptr(addr1); memcpy(addr1, h1->h_addr, copy1.h_length); h2 = gethostbyname(valc); if (h2 == NULL) { - free(addr1); return 0; } if (copy1.h_addrtype != h2->h_addrtype) { - free(addr1); return 0; } if (copy1.h_length != h2->h_length) { - free(addr1); return 0; } - stat = memcmp(addr1, h2->h_addr, copy1.h_length); - - free(addr1); - - return (stat == 0); + return 0 == memcmp(addr1, h2->h_addr, copy1.h_length); } return 0;