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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
72f02926
Commit
72f02926
authored
Feb 14, 2005
by
tomas@poseidon.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed memory-leak in case of connect failure
parent
ba050ad3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
ndb/src/common/transporter/TransporterRegistry.cpp
ndb/src/common/transporter/TransporterRegistry.cpp
+19
-19
No files found.
ndb/src/common/transporter/TransporterRegistry.cpp
View file @
72f02926
...
...
@@ -1488,28 +1488,30 @@ NDB_SOCKET_TYPE TransporterRegistry::connect_ndb_mgmd(SocketClient *sc)
{
NdbMgmHandle
h
;
struct
ndb_mgm_reply
mgm_reply
;
char
*
cs
,
c
[
100
];
bool
d
=
false
;
h
=
ndb_mgm_create_handle
();
if
(
strlen
(
sc
->
get_server_name
())
>
80
)
/**
* Set connectstring
*/
{
/*
* server name is long. malloc enough for it and the port number
*/
cs
=
(
char
*
)
malloc
((
strlen
(
sc
->
get_server_name
())
+
20
)
*
sizeof
(
char
));
if
(
!
cs
)
return
NDB_INVALID_SOCKET
;
d
=
true
;
char
c
[
100
];
char
*
cs
=
&
c
[
0
];
int
len
=
strlen
(
sc
->
get_server_name
())
+
20
;
if
(
len
>
sizeof
(
c
)
)
{
/*
* server name is long. malloc enough for it and the port number
*/
cs
=
(
char
*
)
malloc
(
len
*
sizeof
(
char
));
if
(
!
cs
)
return
NDB_INVALID_SOCKET
;
}
snprintf
(
cs
,
len
,
"%s:%u"
,
sc
->
get_server_name
(),
sc
->
get_port
());
ndb_mgm_set_connectstring
(
h
,
cs
);
if
(
cs
!=
&
c
[
0
])
free
(
cs
);
}
else
cs
=
&
c
[
0
];
snprintf
(
cs
,(
d
)
?
strlen
(
sc
->
get_server_name
()
+
20
)
:
sizeof
(
c
),
"%s:%u"
,
sc
->
get_server_name
(),
sc
->
get_port
());
ndb_mgm_set_connectstring
(
h
,
cs
);
if
(
ndb_mgm_connect
(
h
,
0
,
0
,
0
)
<
0
)
return
NDB_INVALID_SOCKET
;
...
...
@@ -1521,8 +1523,6 @@ NDB_SOCKET_TYPE TransporterRegistry::connect_ndb_mgmd(SocketClient *sc)
CFG_CONNECTION_SERVER_PORT
,
m_transporter_interface
[
i
].
m_s_service_port
,
&
mgm_reply
);
if
(
d
)
free
(
cs
);
return
ndb_mgm_convert_to_transporter
(
h
);
}
...
...
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