mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
util: plug memory leak
Leak detected by Coverity; only possible on unlikely ptsname_r failure. Additionally, the man page for ptsname_r states that failure is merely non-zero, not necessarily -1. * src/util/util.c (virFileOpenTtyAt): Avoid leak on ptsname_r failure.
This commit is contained in:
parent
d69b79ab72
commit
c86827a243
@ -1126,8 +1126,10 @@ int virFileOpenTtyAt(const char *ptmx,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (ptsname_r(*ttymaster, *ttyName, PATH_MAX) < 0)
|
||||
if (ptsname_r(*ttymaster, *ttyName, PATH_MAX) != 0) {
|
||||
VIR_FREE(*ttyName);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
rc = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user