diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-09-21 19:06:14 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-09-21 19:06:14 +0000 |
commit | 06ca08ab518ba90cc82db8cc9ac27b5a25340510 (patch) | |
tree | fb53c39091f9106431605da5af92fab710b74242 /protocols/WhatsApp/src/media.cpp | |
parent | a8af09a3f64f5cb1b7417977ed8265b5a97e4107 (diff) |
WhatsApp:
- Request password with Voice (patch by Cassio)
- minor fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@15418 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src/media.cpp')
-rw-r--r-- | protocols/WhatsApp/src/media.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/protocols/WhatsApp/src/media.cpp b/protocols/WhatsApp/src/media.cpp index 0435eea06d..1d127bafe8 100644 --- a/protocols/WhatsApp/src/media.cpp +++ b/protocols/WhatsApp/src/media.cpp @@ -11,13 +11,16 @@ HANDLE WhatsAppProto::SendFile(MCONTACT hContact, const TCHAR* desc, TCHAR **pps // input validation
char *name = mir_utf8encodeW(ppszFiles[0]);
string mime = MediaUploader::getMimeFromExtension(split(name, '.')[1]);
- if (mime.empty())
+ if (mime.empty()) {
+ mir_free(name);
return 0;
+ }
// get file size
FILE *hFile = _tfopen(ppszFiles[0], _T("rb"));
if (hFile == NULL) {
debugLogA(__FUNCTION__": cannot open file %s", ppszFiles[0]);
+ mir_free(name);
return 0;
}
_fseeki64(hFile, 0, SEEK_END);
@@ -30,18 +33,25 @@ HANDLE WhatsAppProto::SendFile(MCONTACT hContact, const TCHAR* desc, TCHAR **pps // check max file sizes
switch (fileType) {
case FMessage::WA_TYPE_IMAGE:
- if (fileSize >= 5 * 1024 * 1024)
+ if (fileSize >= 5 * 1024 * 1024) {
+ mir_free(name);
return 0;
+ }
break;
case FMessage::WA_TYPE_AUDIO:
- if (fileSize >= 10 * 1024 * 1024)
+ if (fileSize >= 10 * 1024 * 1024) {
+ mir_free(name);
return 0;
+ }
break;
case FMessage::WA_TYPE_VIDEO:
- if (fileSize >= 20 * 1024 * 1024)
+ if (fileSize >= 20 * 1024 * 1024) {
+ mir_free(name);
return 0;
+ }
break;
default:
+ mir_free(name);
return 0;
}
|