qemu-sockets: Plug fd leak on unix_connect_opts() error path
Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
f2d3476eba
commit
9d94747262
@ -572,6 +572,7 @@ int unix_connect_opts(QemuOpts *opts)
|
|||||||
snprintf(un.sun_path, sizeof(un.sun_path), "%s", path);
|
snprintf(un.sun_path, sizeof(un.sun_path), "%s", path);
|
||||||
if (connect(sock, (struct sockaddr*) &un, sizeof(un)) < 0) {
|
if (connect(sock, (struct sockaddr*) &un, sizeof(un)) < 0) {
|
||||||
fprintf(stderr, "connect(unix:%s): %s\n", path, strerror(errno));
|
fprintf(stderr, "connect(unix:%s): %s\n", path, strerror(errno));
|
||||||
|
close(sock);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user