[all] Fix resource leaks
This commit is contained in:
parent
b9df99fd6a
commit
f7e4a8faa9
@ -155,8 +155,10 @@ file_utils::zero_superblock(std::string const &path)
|
||||
throw runtime_error("out of memory");
|
||||
|
||||
memset(buffer, 0, SUPERBLOCK_SIZE);
|
||||
if (::write(fd.fd_, buffer, SUPERBLOCK_SIZE) != SUPERBLOCK_SIZE)
|
||||
if (::write(fd.fd_, buffer, SUPERBLOCK_SIZE) != SUPERBLOCK_SIZE) {
|
||||
free(buffer);
|
||||
throw runtime_error("couldn't zero superblock");
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
@ -62,7 +62,7 @@ chunk const &
|
||||
cache_stream::get()
|
||||
{
|
||||
chunk_wrapper *w = new chunk_wrapper(*this);
|
||||
return w->c_;
|
||||
return w->c_; // wrapper will get freed by the put method
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user