mirror of
https://github.com/ceph/ceph
synced 2025-04-01 23:02:17 +00:00
monclient: fix leaks in build_initial_monmap address lookup
Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
parent
7935e30e34
commit
1f94a8fed5
src
@ -30,6 +30,9 @@ static int safe_cat(char **pstr, int *plen, int pos, const char *str2)
|
||||
return pos + len2;
|
||||
}
|
||||
|
||||
/*
|
||||
* returns a string allocated by malloc; caller must free
|
||||
*/
|
||||
char *mount_resolve_dest(char *orig_str)
|
||||
{
|
||||
char *new_str;
|
||||
|
@ -82,7 +82,10 @@ int MonClient::build_initial_monmap()
|
||||
char *old_addrs = new char[strlen(g_conf.mon_host)+1];
|
||||
strcpy(old_addrs, g_conf.mon_host);
|
||||
hosts = mount_resolve_dest(old_addrs);
|
||||
if (parse_ip_port_vec(hosts, addrs)) {
|
||||
delete old_addrs;
|
||||
bool success = parse_ip_port_vec(hosts, addrs);
|
||||
free(hosts);
|
||||
if (success) {
|
||||
for (unsigned i=0; i<addrs.size(); i++) {
|
||||
char n[2];
|
||||
n[0] = 'a' + i;
|
||||
|
Loading…
Reference in New Issue
Block a user