diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/netlib.h | 1 | ||||
-rw-r--r-- | src/mir_app/src/netlib_http.cpp | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/mir_app/src/netlib.h b/src/mir_app/src/netlib.h index 5f8f35bf0c..bd122db088 100644 --- a/src/mir_app/src/netlib.h +++ b/src/mir_app/src/netlib.h @@ -103,6 +103,7 @@ class MFileChunkStorage : public MChunkHandler public:
MFileChunkStorage(const MFilePath &pwszFileName, pfnDownloadCallback, void*);
+ ~MFileChunkStorage();
__forceinline operator bool() const { return fileId != -1; }
};
diff --git a/src/mir_app/src/netlib_http.cpp b/src/mir_app/src/netlib_http.cpp index cfe28998f1..b34346f768 100644 --- a/src/mir_app/src/netlib_http.cpp +++ b/src/mir_app/src/netlib_http.cpp @@ -1138,12 +1138,19 @@ MFileChunkStorage::MFileChunkStorage(const MFilePath &_1, pfnDownloadCallback _2 fileId = _wopen(_1, _O_WRONLY | _O_TRUNC | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE);
}
+MFileChunkStorage::~MFileChunkStorage()
+{
+ if (fileId != -1) {
+ _close(fileId);
+ fileId = -1;
+ }
+}
+
void MFileChunkStorage::apply(MHttpResponse *nlhr)
{
if (fileId != -1) {
nlhr->resultCode = 200;
nlhr->body = "OK";
- _close(fileId);
}
else nlhr->resultCode = 500;
}
|