mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
util: fix memory leak in virSocketAddrFormatFull
The @ipv6_host allocated in virAsprintf may be lost when virAsprintf addrstr failed. Signed-off-by: Yi Wang <wang.yi59@zte.com.cn> Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
7693f07fee
commit
9f4c39f309
@ -417,8 +417,10 @@ virSocketAddrFormatFull(const virSocketAddr *addr,
|
||||
|
||||
if (virAsprintf(&addrstr, "%s%s%s",
|
||||
ipv6_host ? ipv6_host : host,
|
||||
separator ? separator : ":", port) == -1)
|
||||
separator ? separator : ":", port) == -1) {
|
||||
VIR_FREE(ipv6_host);
|
||||
goto error;
|
||||
}
|
||||
|
||||
VIR_FREE(ipv6_host);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user