Commit fddd3f2c authored by Edward Z. Yang's avatar Edward Z. Yang Committed by Soumith Chintala
Browse files

Fix segfault passing null to sox_close (#174)

parent 873af313
......@@ -18,7 +18,9 @@ struct SoxDescriptor {
SoxDescriptor& operator=(const SoxDescriptor& other) = delete;
SoxDescriptor& operator=(SoxDescriptor&& other) = delete;
~SoxDescriptor() {
sox_close(fd_);
if (fd_ != nullptr) {
sox_close(fd_);
}
}
sox_format_t* operator->() noexcept {
return fd_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment