mirror of https://github.com/Icinga/icinga2.git
Fix memory leak in NetString::ReadStringFromStream.
This commit is contained in:
parent
46659e7551
commit
2ed8f1aaa7
|
@ -49,8 +49,10 @@ bool NetString::ReadStringFromStream(const Stream::Ptr& stream, String *str)
|
|||
int rc = stream->Read(header + read_length, 1);
|
||||
|
||||
if (rc == 0) {
|
||||
if (read_length == 0)
|
||||
if (read_length == 0) {
|
||||
free(header);
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Read() failed."));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue