Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
e59a1dae
Commit
e59a1dae
authored
Sep 14, 2006
by
hartmut@mysql.com/linux.site
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed to use NdbAutoPtr instead of explicit free() calls
as suggested by Jonas (still Bug #17582)
parent
b9372f7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
9 deletions
+3
-9
ndb/tools/ndb_config.cpp
ndb/tools/ndb_config.cpp
+3
-9
No files found.
ndb/tools/ndb_config.cpp
View file @
e59a1dae
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <mgmapi.h>
#include <mgmapi.h>
#include <mgmapi_configuration.hpp>
#include <mgmapi_configuration.hpp>
#include <ConfigInfo.hpp>
#include <ConfigInfo.hpp>
#include <NdbAutoPtr.hpp>
static
int
g_verbose
=
0
;
static
int
g_verbose
=
0
;
static
int
try_reconnect
=
3
;
static
int
try_reconnect
=
3
;
...
@@ -381,7 +382,6 @@ HostMatch::eval(const Iter& iter)
...
@@ -381,7 +382,6 @@ HostMatch::eval(const Iter& iter)
{
{
struct
hostent
*
h1
,
*
h2
,
copy1
;
struct
hostent
*
h1
,
*
h2
,
copy1
;
char
*
addr1
;
char
*
addr1
;
int
stat
;
h1
=
gethostbyname
(
m_value
.
c_str
());
h1
=
gethostbyname
(
m_value
.
c_str
());
if
(
h1
==
NULL
)
{
if
(
h1
==
NULL
)
{
...
@@ -392,30 +392,24 @@ HostMatch::eval(const Iter& iter)
...
@@ -392,30 +392,24 @@ HostMatch::eval(const Iter& iter)
// so we need to copy the results before doing the next call
// so we need to copy the results before doing the next call
memcpy
(
&
copy1
,
h1
,
sizeof
(
struct
hostent
));
memcpy
(
&
copy1
,
h1
,
sizeof
(
struct
hostent
));
addr1
=
(
char
*
)
malloc
(
copy1
.
h_length
);
addr1
=
(
char
*
)
malloc
(
copy1
.
h_length
);
NdbAutoPtr
<
char
>
tmp_aptr
(
addr1
);
memcpy
(
addr1
,
h1
->
h_addr
,
copy1
.
h_length
);
memcpy
(
addr1
,
h1
->
h_addr
,
copy1
.
h_length
);
h2
=
gethostbyname
(
valc
);
h2
=
gethostbyname
(
valc
);
if
(
h2
==
NULL
)
{
if
(
h2
==
NULL
)
{
free
(
addr1
);
return
0
;
return
0
;
}
}
if
(
copy1
.
h_addrtype
!=
h2
->
h_addrtype
)
{
if
(
copy1
.
h_addrtype
!=
h2
->
h_addrtype
)
{
free
(
addr1
);
return
0
;
return
0
;
}
}
if
(
copy1
.
h_length
!=
h2
->
h_length
)
if
(
copy1
.
h_length
!=
h2
->
h_length
)
{
{
free
(
addr1
);
return
0
;
return
0
;
}
}
stat
=
memcmp
(
addr1
,
h2
->
h_addr
,
copy1
.
h_length
);
return
0
==
memcmp
(
addr1
,
h2
->
h_addr
,
copy1
.
h_length
);
free
(
addr1
);
return
(
stat
==
0
);
}
}
return
0
;
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment