lib/nfs/Connection: fix crash while canceling a failing Open()
The method NfsConnection::CancellableCallback::Callback() will always invoke NfsConnection::Close() on the file handle, even if the void pointer is not a nfsfh. This can happen if the Open() was not successful, e.g. when the file does not exist.
This commit is contained in:
parent
3c29aa6271
commit
4b8d258cff
2
NEWS
2
NEWS
@ -1,4 +1,6 @@
|
|||||||
ver 0.19.7 (not yet released)
|
ver 0.19.7 (not yet released)
|
||||||
|
* input
|
||||||
|
- nfs: fix crash while canceling a failing file open operation
|
||||||
* playlist
|
* playlist
|
||||||
- don't skip non-existent songs in "listplaylist"
|
- don't skip non-existent songs in "listplaylist"
|
||||||
* fix memory allocator bug on Windows
|
* fix memory allocator bug on Windows
|
||||||
|
@ -156,8 +156,10 @@ NfsConnection::CancellableCallback::Callback(int err, void *data)
|
|||||||
allocated file handle immediately */
|
allocated file handle immediately */
|
||||||
assert(close_fh == nullptr);
|
assert(close_fh == nullptr);
|
||||||
|
|
||||||
struct nfsfh *fh = (struct nfsfh *)data;
|
if (err >= 0) {
|
||||||
connection.Close(fh);
|
struct nfsfh *fh = (struct nfsfh *)data;
|
||||||
|
connection.Close(fh);
|
||||||
|
}
|
||||||
} else if (close_fh != nullptr)
|
} else if (close_fh != nullptr)
|
||||||
connection.DeferClose(close_fh);
|
connection.DeferClose(close_fh);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user